@nuskin/foundation-ui-components 1.0.0-develop.2 → 1.0.0-develop.3

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.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/src/common/alert/NsAlert.stories.tsx +15 -14
  3. package/src/common/auth-dropdown/NsAuthDropdown.stories.tsx +1 -1
  4. package/src/common/autocomplete/NsAutocomplete.stories.tsx +1 -1
  5. package/src/common/banner/NsBanner.stories.tsx +1 -1
  6. package/src/common/brand-components/NsBrand.stories.tsx +1 -1
  7. package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +1 -7
  8. package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +2 -4
  9. package/src/common/breadcrumb/data.ts +7 -0
  10. package/src/common/button/NsButton.stories.tsx +1 -1
  11. package/src/common/card/stories/NsBgCard.stories.tsx +1 -3
  12. package/src/common/card/stories/NsBrandProductCard.stories.tsx +1 -1
  13. package/src/common/card/stories/NsFfgCard.stories.tsx +1 -1
  14. package/src/common/card/stories/{data.js → data.ts} +1 -25
  15. package/src/common/carousal/NsScrollingCarousal.tsx +26 -2
  16. package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +1 -1
  17. package/src/common/carousal/types.d.ts +2 -0
  18. package/src/common/cart-icon/NsCartIcon.stories.tsx +1 -1
  19. package/src/common/checkbox/NsCheckbox.stories.tsx +1 -1
  20. package/src/common/column-control/NsFlexColumns.tsx +5 -10
  21. package/src/common/column-control/NsGridColumns.tsx +5 -10
  22. package/src/common/column-control/specs/NsColumnControl.spec.tsx +1 -1
  23. package/src/common/column-control/specs/NsFlexColumns.spec.tsx +1 -1
  24. package/src/common/column-control/specs/NsGridColumns.spec.tsx +1 -1
  25. package/src/common/column-control/stories/DivArray.stories.tsx +18 -0
  26. package/src/common/column-control/stories/DivArray.tsx +63 -0
  27. package/src/common/column-control/stories/NsColumnControl.stories.tsx +6 -3
  28. package/src/common/column-control/stories/NsFlexColumns.stories.tsx +13 -9
  29. package/src/common/column-control/stories/NsGridColumns.stories.tsx +12 -8
  30. package/src/common/column-control/stories/common.tsx +1 -1
  31. package/src/common/column-control/styled/StyledFlex.tsx +7 -3
  32. package/src/common/column-control/styled/StyledGrid.tsx +9 -2
  33. package/src/common/column-control/styled/common.ts +2 -2
  34. package/src/common/column-control/types.d.ts +15 -16
  35. package/src/common/dropdown/stories/NsDropdown.stories.tsx +1 -1
  36. package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +1 -1
  37. package/src/common/flag/NsFlag.stories.tsx +1 -1
  38. package/src/common/icon/NsIcon.stories.tsx +1 -1
  39. package/src/common/image/NsImage.stories.tsx +1 -1
  40. package/src/common/image/NsNextImage.stories.tsx +1 -1
  41. package/src/common/input/NsInputField.stories.tsx +2 -1
  42. package/src/common/input/types.d.ts +15 -0
  43. package/src/common/label/NsLabel.stories.tsx +2 -0
  44. package/src/common/label/NsLabel.tsx +3 -3
  45. package/src/common/link/NsLink.stories.tsx +1 -1
  46. package/src/common/nav-product-card/NsNavProductCard.stories.tsx +1 -1
  47. package/src/common/nav-tab/NsNavTab.stories.tsx +1 -1
  48. package/src/common/table/NsTable.stories.tsx +8 -8
  49. package/src/common/text-strip/NsTextStrip.stories.tsx +5 -4
  50. package/src/common/text-strip/NsTextStrip.tsx +5 -2
  51. package/src/common/text-strip/types.d.ts +7 -4
  52. package/src/common/typography/NsTypography.stories.tsx +1 -1
  53. package/src/common/videos/NsVideo.stories.tsx +1 -1
  54. package/src/common/column-control/stories/NDivs.story.tsx +0 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/foundation-ui-components",
3
- "version": "1.0.0-develop.2",
3
+ "version": "1.0.0-develop.3",
4
4
  "description": "It is a foundation library written in react, that provides common components to all UI pages",
5
5
  "private": false,
6
6
  "main": "src/common/index.ts",
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import NsAlert from './NsAlert';
4
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
5
5
 
6
6
  type ComponentType = typeof NsAlert;
7
7
  type Story = StoryObj<ComponentType>;
@@ -12,14 +12,14 @@ export default {
12
12
  component: NsAlert,
13
13
  decorators: [withCenterDecorator],
14
14
  argTypes: {
15
- context: {
15
+ context: {
16
16
  control: 'select',
17
- options: ['error', 'info', 'notice', 'success', 'warning']
17
+ options: ['error', 'info', 'notice', 'success', 'warning'],
18
18
  },
19
- type: {
19
+ type: {
20
20
  control: 'select',
21
- options: ['auto', 'banner', 'card']
22
- }
21
+ options: ['auto', 'banner', 'card'],
22
+ },
23
23
  },
24
24
  args: {
25
25
  context: 'info',
@@ -28,15 +28,16 @@ export default {
28
28
  type: 'banner',
29
29
  visible: true,
30
30
  onDismiss: () => {},
31
- body:
32
- <span>{`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
31
+ body: (
32
+ <span>{`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
33
33
  ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
34
- laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
35
- reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
36
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
37
- qui officia deserunt mollit anim id est laborum.`}</span>,
38
- foot: <span>Some message goes here.</span>
39
- }
34
+ laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
35
+ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
36
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
37
+ qui officia deserunt mollit anim id est laborum.`}</span>
38
+ ),
39
+ foot: <span>Some message goes here.</span>,
40
+ },
40
41
  } as MetaStory;
41
42
 
42
43
  export const AuthDropdown: Story = {};
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import { NsAuthDropdown } from './';
3
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
3
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
4
 
5
5
  type ComponentType = typeof NsAuthDropdown;
6
6
  type Story = StoryObj<ComponentType>;
@@ -7,7 +7,7 @@
7
7
  import React from 'react';
8
8
  import type { StoryObj, Meta } from '@storybook/react';
9
9
 
10
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
10
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
11
11
  import { NsAutocomplete } from './';
12
12
  import { AutocompleteMockList } from './mock/MockData';
13
13
  import { OptionUiComponent } from './mock/MockUI';
@@ -7,7 +7,7 @@
7
7
  import React from 'react';
8
8
  import type { StoryObj, Meta } from '@storybook/react';
9
9
  import { NsBanner, NsTypography, NsButton } from '../';
10
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
10
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
11
11
 
12
12
  type ComponentType = typeof NsBanner;
13
13
  type Story = StoryObj<ComponentType>;
@@ -1,6 +1,6 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
2
  import { NsBrandComponent } from './';
3
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
3
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
4
 
5
5
  type ComponentType = typeof NsBrandComponent;
6
6
  type Story = StoryObj<ComponentType>;
@@ -1,14 +1,8 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
3
  import { NsBreadcrumb } from './';
4
- import { ItemProps } from './types.d';
4
+ import { breadcrumbItems } from './data';
5
5
  const { getByText } = screen;
6
- export const breadcrumbItems: ItemProps[] = [
7
- { label: 'Home', href: '/', icon: 'home' },
8
- { label: 'Products', href: '/products' },
9
- { label: 'Shirts', href: '/products/shirts' },
10
- { label: 'Blue shirt', href: '/products/shirts/blue' },
11
- ];
12
6
 
13
7
  describe('Breadcrumb', () => {
14
8
  it('renders breadcrumb items', () => {
@@ -1,14 +1,12 @@
1
1
  /**
2
- * @author [Vijayaprathap Kumar] (vpkumar@nuskin.com)
3
- * NsBanner.stories.tsx
4
2
  * @description NsBanner component.
5
3
  */
6
4
 
7
5
  import type { Meta, StoryObj } from '@storybook/react';
8
6
 
9
7
  import { NsBreadcrumb } from './';
10
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
11
- import { breadcrumbItems } from './NsBreadcrumb.spec';
8
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
9
+ import { breadcrumbItems } from './data';
12
10
 
13
11
  type ComponentType = typeof NsBreadcrumb;
14
12
  type Story = StoryObj<ComponentType>;
@@ -0,0 +1,7 @@
1
+ import { ItemProps } from './types';
2
+ export const breadcrumbItems: ItemProps[] = [
3
+ { label: 'Home', href: '/', icon: 'home' },
4
+ { label: 'Products', href: '/products' },
5
+ { label: 'Shirts', href: '/products/shirts' },
6
+ { label: 'Blue shirt', href: '/products/shirts/blue' },
7
+ ];
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { StoryObj, Meta } from '@storybook/react';
3
3
  import { NsButton } from './';
4
4
  import { ShoppingCart } from '@mui/icons-material';
5
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
5
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
6
6
 
7
7
  type ComponentType = typeof NsButton;
8
8
  type Story = StoryObj<ComponentType>;
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import { NsBgCard } from '../';
3
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
3
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
4
 
5
5
  type ComponentType = typeof NsBgCard;
6
6
  type Story = StoryObj<ComponentType>;
@@ -13,8 +13,6 @@ export default {
13
13
  args: {
14
14
  title: 'ageLOC LumiSpa',
15
15
  backgroundImageUrl: 'https://media.nuskin.com/m/3604b5202b0b64c6/webimage-brand-lumispa-optweb.png',
16
- // brandImageUrl:
17
- // 'https://media.nuskin.com/m/2571a0407433a6e8/webimage-brand-lumispa.png',
18
16
  },
19
17
  decorators: [withCenterDecorator],
20
18
  } as MetaStory;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsBrandProductCard } from '../';
4
4
 
5
5
  type ComponentType = typeof NsBrandProductCard;
@@ -1,7 +1,7 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
2
  import { within, userEvent } from '@storybook/testing-library';
3
3
  import { expect } from '@storybook/jest';
4
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
5
5
  import { NsFfgCard } from '../';
6
6
 
7
7
  type ComponentType = typeof NsFfgCard;
@@ -8,14 +8,6 @@ export const brandImages = [
8
8
  'https://media.nuskin.com/m/4bd7ab9b46bd456d/webimage-brand-pharmanex.png',
9
9
  'https://media.nuskin.com/m/501d638a8af80087/webimage-brand-ap24.png',
10
10
  'https://media.nuskin.com/m/f3a91129cbbae32/webimage-brand-nutricentials.png',
11
- 'https://media.nuskin.com/m/63a454ff90d038b4/webimage-brand-epoch.png',
12
- 'https://media.nuskin.com/m/3eb406f465d4b0fe/webimage-brand-sunright.png',
13
- 'https://media.nuskin.com/m/2d3276518912283b/webimage-brand-nu_colour.png',
14
- 'https://media.nuskin.com/m/3855d3836d920639/webimage-brand-nuskin180.png',
15
- 'https://media.nuskin.com/m/6245528b8f76ad32/webimage-brand-ageLOC.png',
16
- 'https://media.nuskin.com/m/2571a0407433a6e8/webimage-brand-lumispa.png',
17
- 'https://media.nuskin.com/m/4bd7ab9b46bd456d/webimage-brand-pharmanex.png',
18
- 'https://media.nuskin.com/m/501d638a8af80087/webimage-brand-ap24.png',
19
11
  ];
20
12
 
21
13
  export const brandBackImages = [
@@ -28,34 +20,18 @@ export const brandBackImages = [
28
20
  'https://media.nuskin.com/m/4a1245a63c595262/webimage-brand-pharmanex-optweb.png',
29
21
  'https://media.nuskin.com/m/14a0fd6ef63e5dbb/webimage-brand-ap_24.png',
30
22
  'https://media.nuskin.com/m/298104036e885b40/webimage-brand-nutricentials.png',
31
- 'https://media.nuskin.com/m/549aa3e5184434d8/webimage-brand-epoch-optweb.png',
32
- 'https://media.nuskin.com/m/14e238d7599e1811/webimage-brand-sunright.png',
33
- 'https://media.nuskin.com/m/2543e79419276727/webimage-brand-nu_colour-optweb.png',
34
- 'https://media.nuskin.com/m/446c7a2aad513f58/webimage-brand-nu_skin_180-optweb.png',
35
- 'https://media.nuskin.com/m/42911c8b05600476/webimage-brand-ageloc-optweb.png',
36
- 'https://media.nuskin.com/m/3604b5202b0b64c6/webimage-brand-lumispa-optweb.png',
37
- 'https://media.nuskin.com/m/4a1245a63c595262/webimage-brand-pharmanex-optweb.png',
38
- 'https://media.nuskin.com/m/14a0fd6ef63e5dbb/webimage-brand-ap_24.png',
39
23
  ];
40
24
 
41
25
  export const brandTitles = [
42
26
  'Epoch',
43
27
  'Sunright',
44
- 'Nu Colour',
28
+ 'Nu Color',
45
29
  '180 System',
46
30
  'ageLOC',
47
31
  'ageLOC LumiSpa',
48
32
  'Pharmanex',
49
33
  'AP 24',
50
34
  'Nutricentials',
51
- 'Epoch',
52
- 'Sunright',
53
- 'Nu Colour',
54
- '180 System',
55
- 'ageLOC',
56
- 'ageLOC LumiSpa',
57
- 'Pharmanex',
58
- 'AP 24',
59
35
  ];
60
36
  export const brandEntries = brandTitles.map((title, index) => {
61
37
  return {
@@ -1,6 +1,26 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import Slider from 'react-slick';
3
3
  import { NsScrollingCarousalProps } from '../';
4
+ import { styled } from '@nuskin/foundation-theme';
5
+
6
+ const options = {
7
+ shouldForwardProp: (prop: string) => prop !== 'dotsBottomPixel',
8
+ };
9
+
10
+ const StyledDiv = styled(
11
+ 'div',
12
+ options
13
+ )<{
14
+ dotsBottomPixel?: number;
15
+ }>(({ dotsBottomPixel }) => {
16
+ return {
17
+ '.slick-dots': {
18
+ zIndex: 9,
19
+ bottom: `${dotsBottomPixel ?? -25}px`,
20
+ opacity: '0.5',
21
+ },
22
+ };
23
+ });
4
24
 
5
25
  const NsScrollingCarousal = ({
6
26
  slides,
@@ -8,6 +28,7 @@ const NsScrollingCarousal = ({
8
28
  stillSeconds,
9
29
  renderSlide,
10
30
  settings,
31
+ dotsBottomPixel,
11
32
  additionalProps,
12
33
  }: NsScrollingCarousalProps) => {
13
34
  const defaultSettings = useMemo(() => {
@@ -28,9 +49,12 @@ const NsScrollingCarousal = ({
28
49
  };
29
50
  }, [stillSeconds, scrollSeconds, settings]);
30
51
  return (
31
- <div data-testid={additionalProps?.testid ?? 'scrolling-carousal-test-id'}>
52
+ <StyledDiv
53
+ dotsBottomPixel={dotsBottomPixel}
54
+ data-testid={additionalProps?.testid ?? 'scrolling-carousal-test-id'}
55
+ >
32
56
  <Slider {...defaultSettings}>{slides.map(renderSlide)}</Slider>
33
- </div>
57
+ </StyledDiv>
34
58
  );
35
59
  };
36
60
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { StoryObj, Meta } from '@storybook/react';
7
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
7
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
8
8
  import { NsScrollingCarousal, NsTextStrip } from '@/common/';
9
9
 
10
10
  type ComponentType = typeof NsScrollingCarousal;
@@ -18,4 +18,6 @@ export type NsScrollingCarousalProps<T = any> = {
18
18
  /* time for which slide stays still before scrolling */
19
19
  stillSeconds: number;
20
20
  settings: any;
21
+ /* value in number, specifying how much the dots should be from bottom of slides container */
22
+ dotsBottomPixel?: number;
21
23
  } & AdditionalProps;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsCartIcon } from './';
4
4
 
5
5
  type ComponentType = typeof NsCartIcon;
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { within } from '@testing-library/react';
3
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
3
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
4
  import type { StoryObj, Meta } from '@storybook/react';
5
5
  import { expect } from '@storybook/jest';
6
6
 
@@ -1,23 +1,18 @@
1
- import { PropsWithChildren, useMemo } from 'react';
1
+ import { useMemo } from 'react';
2
2
  import { getColumnSizes } from './utils';
3
3
  import { StyledFlex } from './styled/StyledFlex';
4
- import { AdditionalProps } from '../common.types';
4
+ import { NsFlexColumnsProps } from './types';
5
5
 
6
- type NsFlexColumnsProps = PropsWithChildren<{
7
- columnClass: string;
8
- gap: number;
9
- }> &
10
- AdditionalProps;
11
-
12
- const NsFlexColumns = ({ columnClass, children, gap, additionalProps }: NsFlexColumnsProps) => {
6
+ const NsFlexColumns = ({ columnClass, children, gap, additionalProps, isFullWidth }: NsFlexColumnsProps) => {
13
7
  const sizes = useMemo(() => {
14
8
  return getColumnSizes(columnClass ?? 'ns-col-lg-1-1');
15
9
  }, [columnClass]);
16
10
  return (
17
11
  <StyledFlex
12
+ isFullWidth={isFullWidth || false}
18
13
  gap={gap}
19
14
  sizes={sizes}
20
- className="styled-flex"
15
+ className="ns-flex-columns"
21
16
  data-testid={additionalProps?.testid ?? 'ns-flex-columns'}
22
17
  >
23
18
  {children}
@@ -1,23 +1,18 @@
1
- import { PropsWithChildren, useMemo } from 'react';
1
+ import { useMemo } from 'react';
2
2
  import { getColumnSizes } from './utils';
3
3
  import { StyledGrid } from './styled/StyledGrid';
4
- import { AdditionalProps } from '../common.types';
4
+ import { NsGridColumnsProps } from './types';
5
5
 
6
- type NsGridColumnsProps = PropsWithChildren<{
7
- columnClass: string;
8
- gap: number;
9
- }> &
10
- AdditionalProps;
11
-
12
- const NsGridColumns = ({ columnClass, children, gap, additionalProps }: NsGridColumnsProps) => {
6
+ const NsGridColumns = ({ columnClass, children, gap, isFullWidth, additionalProps }: NsGridColumnsProps) => {
13
7
  const sizes = useMemo(() => {
14
8
  return getColumnSizes(columnClass ?? 'ns-col-lg-1-1');
15
9
  }, [columnClass]);
16
10
  return (
17
11
  <StyledGrid
12
+ isFullWidth={isFullWidth || false}
18
13
  gap={gap}
19
14
  sizes={sizes}
20
- className="styled-grid"
15
+ className="ns-grid-columns"
21
16
  data-testid={additionalProps?.testid ?? 'ns-grid-columns'}
22
17
  >
23
18
  {children}
@@ -1,6 +1,6 @@
1
1
  import { NsColumnControl } from '@/common/index';
2
- import { DivArray } from '../stories/NDivs.story';
3
2
  import { render, screen } from '@/test-utils/index';
3
+ import { DivArray } from '../stories/DivArray';
4
4
 
5
5
  describe('NsColumnControl component', () => {
6
6
  it('renders an column with proper grid value for tablet', () => {
@@ -1,6 +1,6 @@
1
1
  import { render, screen } from '../../../../test-utils';
2
2
  import { NsFlexColumns } from '@/common/index';
3
- import { DivArray } from '../stories/NDivs.story';
3
+ import { DivArray } from '../stories/DivArray';
4
4
 
5
5
  describe('NsFlexColumns component', () => {
6
6
  it('renders an column with proper grid value for tablet', () => {
@@ -1,6 +1,6 @@
1
1
  import { render, screen } from '../../../../test-utils';
2
2
  import { NsGridColumns } from '@/common/index';
3
- import { DivArray } from '../stories/NDivs.story';
3
+ import { DivArray } from '../stories/DivArray';
4
4
 
5
5
  describe('NsGridColumns component', () => {
6
6
  it('renders an column with proper grid value for tablet', () => {
@@ -0,0 +1,18 @@
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
+ import {DivArray} from './DivArray';
4
+
5
+ type ComponentType = typeof DivArray;
6
+ type Story = StoryObj<ComponentType>;
7
+ type MetaStory = Meta<ComponentType>;
8
+
9
+ export default {
10
+ title: 'Components/Column/NDivs',
11
+ component: DivArray,
12
+ decorators: [withCenterDecorator],
13
+ args: {
14
+ elementsCount: 2,
15
+ },
16
+ } as MetaStory;
17
+
18
+ export const Basic: Story = {};
@@ -0,0 +1,63 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ type DivArrayProps = {
4
+ elementsCount: number;
5
+ };
6
+
7
+ const getRandom = (n: number) => (Math.random() * n).toFixed(0);
8
+
9
+ type DivComponentProps = PropsWithChildren<{ style: Record<string, any>; index: number }>;
10
+ export const DivComponent = ({ style, index, children }: DivComponentProps) => {
11
+ const borderWidth = `${getRandom(5)}px`;
12
+ const padding = `${getRandom(20)}px`;
13
+ return (
14
+ <div
15
+ style={{
16
+ padding,
17
+ border: `${borderWidth} solid`,
18
+ borderColor: `hsl(${getRandom(359)},100%, 50%)`,
19
+ background: `hsla(${getRandom(359)},100%, 50%,0.3)`,
20
+ ...style,
21
+ }}
22
+ >
23
+ {index}
24
+ {children}
25
+ </div>
26
+ );
27
+ };
28
+ /**
29
+ * this component return a fragment containing n number of div, with each div numbered as per its index
30
+ * @param n: number of div to render
31
+ * @returns
32
+ */
33
+ export const DivArray = ({ elementsCount }: DivArrayProps) => (
34
+ <>
35
+ {Array(elementsCount)
36
+ .fill(0)
37
+ .map((_, index) => (
38
+ <DivComponent key={index} index={index + 1} style={{}} />
39
+ ))}
40
+ </>
41
+ );
42
+ export const DivArrayRandom = ({ elementsCount }: DivArrayProps) => (
43
+ <>
44
+ {Array(elementsCount)
45
+ .fill(0)
46
+ .map((_, index) => {
47
+ const width = `${getRandom(700)}px`;
48
+ const height = `${getRandom(400)}px`;
49
+ return (
50
+ <DivComponent
51
+ key={index}
52
+ index={index + 1}
53
+ style={{
54
+ width,
55
+ height,
56
+ }}
57
+ >
58
+ item no = {index + 1} with width = {width} and height = {height}
59
+ </DivComponent>
60
+ );
61
+ })}
62
+ </>
63
+ );
@@ -1,7 +1,7 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsColumnControl } from '@/common/index';
4
- import { DivArray } from './NDivs.story';
4
+ import { DivArray } from './DivArray';
5
5
  import { childrenMapping, selectDivOptions } from './common';
6
6
 
7
7
  type ComponentType = typeof NsColumnControl;
@@ -32,7 +32,10 @@ export default {
32
32
  },
33
33
  } as MetaStory;
34
34
 
35
- export const SingleColumnControl: Story = {};
35
+ export const ResponsiveColumnControl: Story = {};
36
+ export const SingleColumnControl: Story = {
37
+ args: { columnClass: '' },
38
+ };
36
39
  export const TwoColumn11: Story = {
37
40
  args: { columnClass: 'ns-col-lg-1-1' },
38
41
  };
@@ -1,8 +1,8 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsFlexColumns } from '..';
4
- import { DivArray } from './NDivs.story';
5
- import {childrenMapping, selectDivOptions } from './common';
4
+ import { DivArray, DivArrayRandom } from './DivArray';
5
+ import { childrenMapping, selectDivOptions } from './common';
6
6
 
7
7
  type ComponentType = typeof NsFlexColumns;
8
8
  type Story = StoryObj<ComponentType>;
@@ -26,17 +26,21 @@ export default {
26
26
  type: 'select',
27
27
  options: selectDivOptions,
28
28
  },
29
- defaultValue: <DivArray elementsCount={8} />,
29
+ defaultValue: <DivArrayRandom elementsCount={8} />,
30
30
  mapping: childrenMapping,
31
31
  },
32
32
  },
33
33
  args: {
34
- columnClass: 'ns-col-lg-1-1-1',
35
- children: <DivArray elementsCount={12} />,
34
+ columnClass: '',
35
+ children: <DivArrayRandom elementsCount={12} />,
36
36
  },
37
37
  } as MetaStory;
38
38
 
39
- export const SingleColumnControl: Story = {};
39
+ export const DefaultColumnControl: Story = {
40
+ args: {
41
+ children: <DivArray elementsCount={8} />,
42
+ },
43
+ };
40
44
  export const TwoColumn11: Story = {
41
45
  args: { columnClass: 'ns-col-lg-1-1' },
42
46
  };
@@ -50,10 +54,10 @@ export const ThreeColumn211: Story = {
50
54
  export const ThreeColumn121: Story = {
51
55
  args: { columnClass: 'ns-col-lg-1-2-1' },
52
56
  };
53
- export const ThreeColumn111Responsive: Story = {
57
+ export const ThreeColumn111: Story = {
54
58
  args: { columnClass: 'ns-col-lg-1-1-1' },
55
59
  };
56
60
 
57
- export const FourColumn1111Responsive: Story = {
61
+ export const FourColumn1111: Story = {
58
62
  args: { columnClass: 'ns-col-lg-1-1-1-1' },
59
63
  };
@@ -1,7 +1,7 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsGridColumns } from '..';
4
- import { DivArray } from './NDivs.story';
4
+ import { DivArray, DivArrayRandom } from './DivArray';
5
5
  import { childrenMapping, selectDivOptions } from './common';
6
6
 
7
7
  type ComponentType = typeof NsGridColumns;
@@ -26,17 +26,21 @@ export default {
26
26
  type: 'select',
27
27
  options: selectDivOptions,
28
28
  },
29
- defaultValue: <DivArray elementsCount={8} />,
29
+ defaultValue: <DivArrayRandom elementsCount={8} />,
30
30
  mapping: childrenMapping,
31
31
  },
32
32
  },
33
33
  args: {
34
- columnClass: 'ns-col-lg-1-1-1',
35
- children: <DivArray elementsCount={12} />,
34
+ columnClass: '',
35
+ children: <DivArrayRandom elementsCount={12} />,
36
36
  },
37
37
  } as MetaStory;
38
38
 
39
- export const SingleColumnControl: Story = {};
39
+ export const DefaultColumnControl: Story = {
40
+ args: {
41
+ children: <DivArray elementsCount={8} />,
42
+ },
43
+ };
40
44
  export const TwoColumn11: Story = {
41
45
  args: { columnClass: 'ns-col-lg-1-1' },
42
46
  };
@@ -50,10 +54,10 @@ export const ThreeColumn211: Story = {
50
54
  export const ThreeColumn121: Story = {
51
55
  args: { columnClass: 'ns-col-lg-1-2-1' },
52
56
  };
53
- export const ThreeColumn111Responsive: Story = {
57
+ export const ThreeColumn111: Story = {
54
58
  args: { columnClass: 'ns-col-lg-1-1-1' },
55
59
  };
56
60
 
57
- export const FourColumn1111Responsive: Story = {
61
+ export const FourColumn1111: Story = {
58
62
  args: { columnClass: 'ns-col-lg-1-1-1-1' },
59
63
  };
@@ -1,4 +1,4 @@
1
- import { DivArray } from './NDivs.story';
1
+ import { DivArray } from './DivArray';
2
2
 
3
3
  /* an array from 1 to n */
4
4
  export const selectDivOptions = Array(16)
@@ -4,31 +4,35 @@ import { sizeObjectType } from '../types';
4
4
  import { commonStyles, getPercentArray } from './common';
5
5
 
6
6
  const options = {
7
- shouldForwardProp: (propKey: string) => propKey !== 'sizes | gap',
7
+ shouldForwardProp: (propKey: string) => !['sizes', 'gap', 'isFullWidth'].includes(propKey),
8
8
  };
9
9
 
10
10
  type StyledFlexProps = {
11
11
  sizes: sizeObjectType;
12
12
  gap?: number;
13
+ isFullWidth: boolean;
13
14
  };
14
15
 
15
16
  /* main wrapper for column control using css flex */
16
17
  export const StyledFlex = styled(
17
18
  Box as any,
18
19
  options
19
- )<StyledFlexProps>(({ sizes, gap }: StyledFlexProps) => {
20
+ )<StyledFlexProps>(({ sizes, gap, isFullWidth }: StyledFlexProps) => {
20
21
  const gridGap = gap ? `${gap}px` : '2rem';
21
22
  const fraction = getPercentArray(sizes.fractions);
22
23
  const flexResponsive = { flexGrow: 1, flexShrink: 1 };
24
+ const maxWidth = isFullWidth ? '100%' : '1200px';
23
25
  const style: any = {
24
26
  gap: gridGap,
25
27
  ...commonStyles,
28
+ maxWidth,
26
29
  display: 'flex',
27
30
  paddingInline: '20px',
28
31
  flexWrap: 'wrap',
29
32
  justifyContent: 'center',
30
- ' > *': {
33
+ '> *': {
31
34
  display: 'flex',
35
+ minWidth: '220px',
32
36
  },
33
37
  };
34
38
  fraction.forEach((f, i) => {
@@ -6,26 +6,33 @@ import { commonStyles, getPercentArray } from './common';
6
6
  type StyledGridProps = {
7
7
  sizes: sizeObjectType;
8
8
  gap?: number;
9
+ isFullWidth: boolean;
9
10
  };
10
11
  const options = {
11
- shouldForwardProp: (propKey: string) => propKey !== 'sizes | gap',
12
+ shouldForwardProp: (propKey: string) => !['sizes', 'gap', 'isFullWidth'].includes(propKey),
12
13
  };
13
14
 
14
15
  /* main wrapper for column control using css grid */
15
16
  export const StyledGrid = styled(
16
17
  Box as any,
17
18
  options
18
- )<StyledGridProps>(({ sizes, gap }: StyledGridProps) => {
19
+ )<StyledGridProps>(({ sizes, gap, isFullWidth }: StyledGridProps) => {
19
20
  const gridGap = gap ?? '2rem';
21
+ const maxWidth = isFullWidth ? '100%' : '1200px';
20
22
  return {
21
23
  gap: gridGap,
22
24
  ...commonStyles,
25
+ maxWidth,
23
26
  display: 'grid',
24
27
  /* here we are creating gridTemplateColumns as calc(40% - 20px) calc(40% - 20px), */
25
28
  gridTemplateColumns: getPercentArray(sizes.fractions)
26
29
  ?.map((fractionPercent) => `calc(${fractionPercent} - 20px)`)
27
30
  .join(''),
28
31
  justifyContent: 'center',
32
+ '> *': {
33
+ minWidth: '220px',
34
+ width: 'auto !important',
35
+ },
29
36
  '.span-2': {
30
37
  gridColumn: 'span 2',
31
38
  },
@@ -1,8 +1,8 @@
1
1
  const mobileBreakPoint = '600px';
2
- // TODO: we need to add a prop in the to allow full width of page instead of 1200px
2
+
3
3
  export const commonStyles = {
4
- maxWidth: '1200px',
5
4
  margin: '32px auto',
5
+
6
6
  [`@media (max-width: ${mobileBreakPoint})`]: {
7
7
  display: 'flex',
8
8
  flexDirection: 'column',
@@ -18,22 +18,7 @@ export type NsColumnControlProps = PropsWithChildren<{
18
18
  * ns-col-md-(column-ratio) (for tablet screens >= 600px),
19
19
  * and ns-col-sm-(column-ratio) (for mobile screens i.e < 600px)
20
20
  * sample values
21
- * 'ns-col-lg-2-1',
22
- 'ns-col-lg-1-2',
23
- 'ns-col-lg-1-1',
24
- 'ns-col-lg-1-1-1',
25
- 'ns-col-lg-2-1-1',
26
- 'ns-col-lg-1-1-1-1',
27
- 'ns-col-md-1',
28
- 'ns-col-md-1-1',
29
- 'ns-col-md-1-2',
30
- 'ns-col-md-2-1',
31
- 'ns-col-md-1-1-1',
32
- 'ns-col-md-2-1-1',
33
- 'ns-col-sm-1',
34
- 'ns-col-sm-1-1',
35
- 'ns-col-sm-1-2',
36
- 'ns-col-sm-2-1',
21
+ * 'ns-col-lg-2-1', 'ns-col-lg-1-2', 'ns-col-lg-1-1',
37
22
  */
38
23
  columnClass: string;
39
24
  gap?: number;
@@ -45,3 +30,17 @@ export type sizeObjectType = {
45
30
  tabletFractions?: number[];
46
31
  mobileFractions?: number[];
47
32
  };
33
+
34
+ export type NsFlexColumnsProps = PropsWithChildren<{
35
+ /**
36
+ * follows the convention of ns-col-lg-{column-ratio}
37
+ * sample value for column-ratio = 2-1 ==>ns-col-lg-2-1
38
+ */
39
+ columnClass: string;
40
+ gap: number;
41
+ /* when this boolean is true, column control takes full width of page instead of being restricted to 1200px */
42
+ isFullWidth?: boolean;
43
+ }> &
44
+ AdditionalProps;
45
+
46
+ export type NsGridColumnsProps = NsFlexColumnsProps;
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { NsDropdown, NsDropdownOption } from '../';
4
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
5
5
 
6
6
  type ComponentType = typeof NsDropdown;
7
7
  type Story = StoryObj<ComponentType>;
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { NsDropdown, NsDropdownOption } from '../';
4
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
5
5
 
6
6
  type ComponentType = typeof NsDropdown;
7
7
  type Story = StoryObj<ComponentType>;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsFlag } from './';
4
4
 
5
5
  type ComponentType = typeof NsFlag;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsIcon, NsIconVariants } from './';
4
4
 
5
5
  type ComponentType = typeof NsIcon;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsImage } from './';
4
4
 
5
5
  type ComponentType = typeof NsImage;
@@ -1,5 +1,5 @@
1
1
  import { NsNextImage } from '.';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import type { StoryObj, Meta } from '@storybook/react';
4
4
 
5
5
  type ComponentType = typeof NsNextImage;
@@ -1,6 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import { NsInputField } from '.';
3
3
  import { NsIcon } from '../icon';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
5
 
5
6
  type ComponentType = typeof NsInputField;
6
7
  type Story = StoryObj<ComponentType>;
@@ -9,7 +10,7 @@ type MetaStory = Meta<ComponentType>;
9
10
  export default {
10
11
  title: 'Components/NsInputField',
11
12
  component: NsInputField,
12
- decorators: [(story) => <div style={{ margin: '20px' }}>{story()}</div>],
13
+ decorators: [withCenterDecorator],
13
14
 
14
15
  args: {},
15
16
  argTypes: {
@@ -17,11 +17,26 @@ export type NsInputFieldProps = Omit<
17
17
  | 'select'
18
18
  | 'SelectProps'
19
19
  > & {
20
+ /**
21
+ * has default undefined value, and we can update the value to success
22
+ * on successful validation and update value to 'error' in case of error
23
+ */
24
+
20
25
  fieldState?: fieldStateType;
21
26
  iconStart?: ReactNode;
27
+ /**
28
+ * assign react component for end icon
29
+ */
22
30
  iconEnd?: ReactNode;
31
+ /**
32
+ * assign react component for side icon
33
+ */
34
+
23
35
  iconSide?: ReactNode;
24
36
  /** purpose of showOptional props is to show additional text 'optional' in the label,
25
37
  * if required = false and this flag is true */
26
38
  showOptional?: boolean;
39
+ defaultValue?: string;
40
+ rows?: number;
41
+ id?: string;
27
42
  };
@@ -1,5 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import { NsLabel } from '.';
3
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
4
 
4
5
  type ComponentType = typeof NsLabel;
5
6
  type Story = StoryObj<ComponentType>;
@@ -8,6 +9,7 @@ type MetaStory = Meta<ComponentType>;
8
9
  export default {
9
10
  component: NsLabel,
10
11
  title: 'Components/NsLabel',
12
+ decorators: [withCenterDecorator],
11
13
  } as MetaStory;
12
14
 
13
15
  export const Default: Story = {
@@ -1,13 +1,13 @@
1
- import { InputLabel } from '@mui/material';
1
+ import { FormLabel } from '@mui/material';
2
2
  import { NsLabelProps } from './types.d';
3
3
  import { styled, nuskinTheme } from '@nuskin/foundation-theme';
4
4
 
5
5
  const { colors } = nuskinTheme;
6
6
 
7
- const StyledLabel = styled(InputLabel)(({ theme }: any) => {
7
+ const StyledLabel = styled(FormLabel)<{ fontSize?: number }>(({ theme, fontSize }) => {
8
8
  const isLight = theme.palette?.primary?.main === '#252525';
9
9
  return {
10
- fontSize: '14px',
10
+ fontSize: fontSize ? `${fontSize}px` : '14px',
11
11
  color: theme.palette?.primary?.main ?? '#252525',
12
12
  '.optional-label': {
13
13
  color: isLight ? colors?.neutral?.[60] : colors?.neutral?.[50],
@@ -6,7 +6,7 @@
6
6
 
7
7
  import React from 'react';
8
8
  import type { StoryObj, Meta } from '@storybook/react';
9
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
9
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
10
10
 
11
11
  import { NsLink } from './';
12
12
  import { NsTypography } from '../typography';
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsNavProductCard } from './';
4
4
 
5
5
  type ComponentType = typeof NsNavProductCard;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsNavTab } from './';
4
4
 
5
5
  type ComponentType = typeof NsNavTab;
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import NsTable from './NsTable';
3
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
3
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
4
 
5
5
  type ComponentType = typeof NsTable;
6
6
  type Story = StoryObj<ComponentType>;
@@ -9,15 +9,15 @@ const headers = [
9
9
  {
10
10
  label: 'Dessert (100g serving)',
11
11
  id: 'name',
12
- numeric: false
12
+ numeric: false,
13
13
  },
14
- { label: 'Calories', id: 'calories' , numeric: true},
14
+ { label: 'Calories', id: 'calories', numeric: true },
15
15
  { label: 'Fat (g)', id: 'fat', numeric: true },
16
16
  { label: 'Carbs (g)', id: 'carbs', numeric: true },
17
17
  { label: 'Protein (g)', id: 'protein', numeric: true },
18
18
  { label: 'Iron (%)', id: 'iron', numeric: false },
19
19
  ];
20
-
20
+
21
21
  const items = [
22
22
  {
23
23
  name: 'Frozen Yogurt',
@@ -106,9 +106,9 @@ export default {
106
106
  component: NsTable,
107
107
  decorators: [withCenterDecorator],
108
108
  argTypes: {
109
- rows: {
109
+ rows: {
110
110
  control: 'select',
111
- options: [5, 10, 25]
111
+ options: [5, 10, 25],
112
112
  },
113
113
  },
114
114
  args: {
@@ -116,8 +116,8 @@ export default {
116
116
  items: items,
117
117
  rows: 5,
118
118
  itemKey: 'name',
119
- rowsPerPageOptions: [5, 10, 25]
120
- }
119
+ rowsPerPageOptions: [5, 10, 25],
120
+ },
121
121
  } as MetaStory;
122
122
 
123
123
  export const NasTable: Story = {};
@@ -5,7 +5,7 @@
5
5
 
6
6
  import type { StoryObj, Meta } from '@storybook/react';
7
7
  import { NsTextStrip } from '@/common/';
8
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
8
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
9
9
 
10
10
  type ComponentType = typeof NsTextStrip;
11
11
  type Story = StoryObj<ComponentType>;
@@ -16,8 +16,10 @@ export default {
16
16
  component: NsTextStrip,
17
17
  decorators: [withCenterDecorator],
18
18
  argTypes: {
19
- children: {
20
- control: 'text', // use the text control to edit children prop
19
+ alignment: {
20
+ control: 'select',
21
+ options: ['center', 'start', 'end'],
22
+ description: 'specify whether items should be in center, start or end',
21
23
  },
22
24
  },
23
25
  args: {
@@ -25,7 +27,6 @@ export default {
25
27
  description: 'Download the app to access everything Nike',
26
28
  link: { href: 'https://www.nike.com/in/help/a/shipping-delivery-gs', title: 'View Details' },
27
29
  alignment: 'center',
28
- justify: 'center',
29
30
  },
30
31
  } as MetaStory;
31
32
 
@@ -16,7 +16,10 @@ const getIsLight = (theme: FoundationTheme.Theme) => {
16
16
  };
17
17
  const StyledHeader = styled.header`
18
18
  background: ${({ theme }) => (getIsLight(theme) ? '#f5f5f5' : getPaletteColor(theme, 'primary', 'contrastText'))};
19
- padding: 10px;
19
+ display: flex;
20
+ flex-direction: column;
21
+ min-height: 60px;
22
+ padding: 2px 10px 12px;
20
23
  a {
21
24
  text-decoration: underline;
22
25
  font-weight: 600;
@@ -26,7 +29,7 @@ const NsTextStrip = (props: NsTextStripProps) => {
26
29
  const { alignment = 'center', text, description, link, className = '' } = props;
27
30
 
28
31
  return (
29
- <StyledHeader className={`${className} justify-${alignment}`}>
32
+ <StyledHeader className={`${className} items-${alignment}`}>
30
33
  <NsTypography variant="h5" weight="bold">
31
34
  {text}
32
35
  </NsTypography>
@@ -2,13 +2,16 @@ import { AdditionalProps } from '../common.types';
2
2
 
3
3
  export type AlignmentType = 'start' | 'center' | 'end';
4
4
 
5
- export type NsTextStripProps = {
6
- alignment?: AlignmentType;
7
- className?: string;
5
+ export type TextCtaDataType = {
8
6
  link?: {
9
7
  href?: string;
10
8
  title?: string;
11
9
  };
12
10
  text?: string;
13
11
  description?: string;
14
- } & AdditionalProps;
12
+ };
13
+ export type NsTextStripProps = {
14
+ alignment?: AlignmentType;
15
+ className?: string;
16
+ } & AdditionalProps &
17
+ TextCtaDataType;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsTypography } from './';
4
4
 
5
5
  type ComponentType = typeof NsTypography;
@@ -7,7 +7,7 @@
7
7
  import type { Meta, StoryObj } from '@storybook/react';
8
8
 
9
9
  import { NsVideo } from '.';
10
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
10
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
11
11
 
12
12
  type ComponentType = typeof NsVideo;
13
13
  type Story = StoryObj<ComponentType>;
@@ -1,35 +0,0 @@
1
- import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
3
-
4
- type DivArrayProps = {
5
- elementsCount: number;
6
- };
7
-
8
- /**
9
- * this component return a fragment containing n number of div, with each div numbered as per its index
10
- * @param n: number of div to render
11
- * @returns
12
- */
13
- export const DivArray = ({ elementsCount }: DivArrayProps) => (
14
- <>
15
- {Array(elementsCount)
16
- .fill(0)
17
- .map((e, i) => (
18
- <div key={i}>{i + 1}</div>
19
- ))}
20
- </>
21
- );
22
- type ComponentType = typeof DivArray;
23
- type Story = StoryObj<ComponentType>;
24
- type MetaStory = Meta<ComponentType>;
25
-
26
- export default {
27
- title: 'Components/NsColumnControl/NDivs',
28
- component: DivArray,
29
- decorators: [withCenterDecorator],
30
- args: {
31
- n: 2,
32
- },
33
- } as MetaStory;
34
-
35
- export const Basic: Story = {};