oddsgate-ds 1.0.113 → 1.0.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  import { IMarquee } from './Marquee.interface';
2
2
  import React from 'react';
3
- declare const Marquee: ({ text, className, onClick, ...props }: IMarquee) => React.JSX.Element;
3
+ declare const Marquee: ({ direction, speed, repeatContent, gap, children, }: IMarquee) => React.JSX.Element;
4
4
  export default Marquee;
@@ -1,7 +1,13 @@
1
- import { CSSProperties } from 'react';
2
- export type IMarquee = {
3
- text?: string;
1
+ /// <reference types="react" />
2
+ import { CSSProperties } from "styled-components";
3
+ export type Direction = 'left' | 'right' | 'up' | 'down';
4
+ export interface IMarquee {
5
+ direction?: Direction;
6
+ repeatContent?: number;
7
+ duration?: number;
8
+ speed?: number;
9
+ gap?: string;
4
10
  className?: string;
5
11
  style?: CSSProperties;
6
- onClick?: () => void;
7
- };
12
+ children: React.ReactNode;
13
+ }
package/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as React$1 from 'react';
2
2
  import React__default, { CSSProperties } from 'react';
3
3
  import { spaces as spaces$1 } from '@/styles/variables';
4
4
  import * as styled_components from 'styled-components';
5
+ import { CSSProperties as CSSProperties$1 } from 'styled-components';
5
6
 
6
7
  declare const pxToRem: (size: number) => string;
7
8
  declare const fontName = "MD Nichrome";
@@ -375,14 +376,19 @@ type ISocialLinks = {
375
376
 
376
377
  declare const SocialLinks: ({ variant, socials, className, style, ...props }: ISocialLinks) => React__default.JSX.Element;
377
378
 
378
- type IMarquee = {
379
- text?: string;
379
+ type Direction = 'left' | 'right' | 'up' | 'down';
380
+ interface IMarquee {
381
+ direction?: Direction;
382
+ repeatContent?: number;
383
+ duration?: number;
384
+ speed?: number;
385
+ gap?: string;
380
386
  className?: string;
381
- style?: CSSProperties;
382
- onClick?: () => void;
383
- };
387
+ style?: CSSProperties$1;
388
+ children: React.ReactNode;
389
+ }
384
390
 
385
- declare const Marquee: ({ text, className, onClick, ...props }: IMarquee) => React__default.JSX.Element;
391
+ declare const Marquee: ({ direction, speed, repeatContent, gap, children, }: IMarquee) => React__default.JSX.Element;
386
392
 
387
393
  type PortalComponentProps = {
388
394
  wrapperId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oddsgate-ds",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,16 +1,21 @@
1
- import Heading from '../Heading/Heading.component'
2
1
  import { IMarquee } from './Marquee.interface'
3
2
  import React from 'react'
4
3
  import { StyledMarquee } from './Marquee.theme'
5
- import cn from 'classnames'
6
4
 
7
- const Marquee = ({ text, className, onClick, ...props }: IMarquee) => {
5
+ const Marquee = ({
6
+ direction = 'left',
7
+ speed = 20,
8
+ repeatContent = 5,
9
+ gap = '0px',
10
+ children,
11
+ }: IMarquee) => {
12
+ // To ensure continuous flow, duplicate the children multiple times based on the content size and container.
13
+ const content = Array.from({ length: repeatContent }, () => children);
14
+
8
15
  return (
9
- <StyledMarquee className={cn(className)} onClick={onClick} {...props}>
16
+ <StyledMarquee direction={direction} duration={speed} gap={gap}>
10
17
  <div>
11
- <Heading size="display" tag="span" className='fw-bold text-uppercase'>
12
- {text} {text} {text}
13
- </Heading>
18
+ {content}
14
19
  </div>
15
20
  </StyledMarquee>
16
21
  )
@@ -1,8 +1,15 @@
1
- import { CSSProperties } from 'react';
1
+ import { CSSProperties } from "styled-components";
2
2
 
3
- export type IMarquee = {
4
- text?: string
5
- className?: string,
3
+ export type Direction = 'left' | 'right' | 'up' | 'down';
4
+
5
+ export interface IMarquee {
6
+ direction?: Direction;
7
+ repeatContent?: number;
8
+ duration?: number;
9
+ speed?: number;
10
+ gap?: string;
11
+ className?: string;
6
12
  style?: CSSProperties
7
- onClick?: () => void
13
+ children: React.ReactNode;
8
14
  }
15
+
@@ -1,5 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
2
 
3
+ import Heading from '@/components/atoms/Heading/Heading.component'
3
4
  import { IMarquee } from './Marquee.interface'
4
5
  import Marquee from './Marquee.component'
5
6
  import React from 'react'
@@ -14,6 +15,7 @@ export default {
14
15
  export const Simple: StoryObj<IMarquee> = {
15
16
  render: args => <Marquee {...args} />,
16
17
  args: {
17
- text: "People • Sustainability • Efficiency • Innovation"
18
+ gap: "1rem",
19
+ children: <Heading>People • Sustainability • Efficiency • Innovation</Heading>
18
20
  }
19
21
  }
@@ -1,40 +1,48 @@
1
+ import { Direction, IMarquee } from './Marquee.interface';
1
2
  import { colors, radius } from '@/styles/variables';
2
- import styled, { css } from 'styled-components';
3
-
4
- import { IMarquee } from './Marquee.interface';
3
+ import styled, { css, keyframes } from 'styled-components';
4
+
5
+ const getAnimation = (direction?: Direction) => {
6
+ switch (direction) {
7
+ case 'up':
8
+ case 'down':
9
+ return keyframes`
10
+ from { transform: translateY(0); }
11
+ to { transform: translateY(-100%); }
12
+ `;
13
+ case 'left':
14
+ case 'right':
15
+ return keyframes`
16
+ from { transform: translateX(0); }
17
+ to { transform: translateX(-100%); }
18
+ `;
19
+ }
20
+ };
5
21
 
6
22
  export const StyledMarquee = styled.div<IMarquee>`
23
+ display: flex;
7
24
  position: relative;
8
- top: 0;
9
- left: 0;
10
25
  width: 100%;
11
- contain: paint;
12
- pointer-events: none;
13
-
14
- --offset: 20vw;
15
- --move-initial: calc(-25% + var(--offset));
16
- --move-final: calc(-50% + var(--offset));
17
-
18
- color: ${colors.primary50};
19
-
20
- padding: 8px 0;
26
+ height: 100%;
27
+ overflow: hidden;
21
28
 
22
- & > div{
23
- position: relative;
29
+ &>div{
24
30
  display: flex;
25
- width: fit-content;
31
+ ${({ gap }) => css`gap: ${gap}`};
26
32
  white-space: nowrap;
27
- transform: translate3d(var(--move-initial), 0, 0);
28
- animation: marquee 15s linear infinite;
29
- }
33
+ width: ${({ direction }) => (direction === 'left' || direction === 'right' ? '200%' : 'auto')};
34
+ height: ${({ direction }) => (direction === 'up' || direction === 'down' ? '200%' : 'auto')};
35
+ flex-direction: ${({ direction }) => (direction === 'up' || direction === 'down' ? 'column' : 'row')};
30
36
 
31
- @keyframes marquee {
32
- 0% {
33
- transform: translate3d(var(--move-initial), 0, 0);
34
- }
37
+ animation: ${({ direction, duration }) => css`
38
+ ${getAnimation(direction)} ${duration}s linear infinite
39
+ `};
35
40
 
36
- 100% {
37
- transform: translate3d(var(--move-final), 0, 0);
41
+ animation-play-state: running; // Ensures the animation is running by default
42
+
43
+ &:hover {
44
+ animation-play-state: paused; // Pauses the animation when hovered
38
45
  }
39
46
  }
47
+
40
48
  `;