{/* prettier-ignore */}
{/*
Copyright 2023 Comcast Cable Communications Management, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
\*/}

import { Meta } from '@storybook/blocks';
import * as withMarqueeSyncStories from './withMarqueeSync.stories';

<Meta of={withMarqueeSyncStories} />

# withMarqueeSync

Use `withMarqueeSync` to synchronize the marquee starting point and timing across multiple TextBoxes.

## Source

https://github.com/rdkcentral/Lightning-UI-Components/blob/develop/packages/@lightningjs/ui-components/src/mixins/withMarqueeSync/withMarqueeSync.js

## Usage

Let's use an example to see how we can use `withMarqueeSync`. The `withMarqueeSync` mixin will use the array returned by `this.syncArray` to tell which TextBoxes to synchronize and apply the required logic:

```js
import { Base, TextBox, withMarqueeSync } from '@lightningjs/ui-components';

class Basic extends withMarqueeSync(Base) {
  static _template() {
    return {
      Example: {
        Title: {
          type: TextBox,
          content: 'Title Text',
          marquee: true
        },
        Description: {
          type: TextBox,
          content: 'Description text, longer than the title',
          marquee: true
        }
      }
    };
  }

  get syncArray() {
    return [this.tag('Title'), this.tag('Description')];
  }
}
```

### Properties

| name      | type  | required | default | description                                  |
| --------- | ----- | -------- | ------- | -------------------------------------------- |
| syncArray | array | true     | -       | the items this mixin should be synchronizing |
