@faststore/core 0.3.17 → 2.0.65-alpha.0
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.
- package/.storybook/storybook.css +1 -0
- package/.turbo/turbo-build.log +50 -0
- package/.turbo/turbo-lint.log +2 -0
- package/@generated/graphql/index.ts +27 -3
- package/@generated/graphql/persisted.json +1 -1
- package/CHANGELOG.md +116 -180
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +3 -3
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +8 -8
- package/package.json +8 -9
- package/src/Layout.tsx +1 -1
- package/src/components/cart/CartItem/CartItem.tsx +30 -71
- package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
- package/src/components/cart/CartSidebar/CartSidebar.tsx +9 -12
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- package/src/components/common/Footer/footer.module.scss +2 -28
- package/src/components/common/Footer/index.ts +1 -0
- package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.tsx +1 -1
- package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
- package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
- package/src/components/common/Toast/Toast.tsx +1 -1
- package/src/components/product/ProductCard/ProductCard.tsx +44 -59
- package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
- package/src/components/regionalization/Regionalization.stories.mdx +24 -6
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
- package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
- package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
- package/src/components/search/Filter/Facets.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.tsx +1 -1
- package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
- package/src/components/search/Filter/FilterSlider.tsx +2 -2
- package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProductDetails/ProductDetails.tsx +2 -2
- package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
- package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
- package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
- package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
- package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
- package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
- package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
- package/src/components/ui/Gift/Gift.tsx +12 -15
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
- package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
- package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
- package/src/components/ui/Tiles/tiles.module.scss +11 -13
- package/src/components/ui/Toast/Toast.stories.mdx +1 -1
- package/src/components/ui/Toast/Toast.tsx +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/sdk/cart/index.ts +5 -0
- package/src/sdk/cart/useBuyButton.ts +1 -1
- package/src/sdk/cart/useCartToggleButton.ts +1 -1
- package/src/styles/vendors/include-media.scss +1 -1
- package/tsconfig.json +3 -5
- package/.eslintrc.json +0 -3
- package/.github/CODEOWNERS +0 -2
- package/.github/workflows/release.yml +0 -42
- package/.release-it.json +0 -32
- package/src/components/cart/CartItem/cart-item.module.scss +0 -68
- package/src/components/product/ProductCard/product-card.module.scss +0 -254
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
- package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
- package/src/components/skeletons/Shimmer/index.ts +0 -1
- package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
- package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
- package/src/components/skeletons/Skeleton/index.ts +0 -1
- package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
- package/src/components/skeletons/Skeletons.stories.mdx +0 -177
- package/src/components/ui/Modal/Modal.stories.mdx +0 -144
- package/src/components/ui/Modal/Modal.tsx +0 -43
- package/src/components/ui/Modal/index.ts +0 -1
- package/src/components/ui/Modal/modal.module.scss +0 -46
- package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
- package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
- package/src/components/ui/ProductTitle/index.ts +0 -1
- package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
- package/src/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { TokenTable, TokenRow } from 'src/../.storybook/components'
|
|
4
|
-
import { SectionList, SectionItem } from 'src/../.storybook/components'
|
|
5
|
-
|
|
6
|
-
import Skeleton from './Skeleton'
|
|
7
|
-
import FilterSkeleton from './FilterSkeleton'
|
|
8
|
-
import ProductCardSkeleton from './ProductCardSkeleton'
|
|
9
|
-
|
|
10
|
-
import Icon from 'src/components/ui/Icon'
|
|
11
|
-
|
|
12
|
-
export const TemplateSkeleton = ({ ...args }) => <Skeleton {...args} />
|
|
13
|
-
|
|
14
|
-
<Meta
|
|
15
|
-
component={Skeleton}
|
|
16
|
-
title="Features/Skeletons/Overview"
|
|
17
|
-
argTypes={{
|
|
18
|
-
loading: {
|
|
19
|
-
control: 'boolean',
|
|
20
|
-
table: { type: 'boolean', summary: true },
|
|
21
|
-
},
|
|
22
|
-
shimmer: {
|
|
23
|
-
control: 'boolean',
|
|
24
|
-
table: { type: 'boolean', summary: false },
|
|
25
|
-
},
|
|
26
|
-
}}
|
|
27
|
-
/>
|
|
28
|
-
|
|
29
|
-
<header>
|
|
30
|
-
|
|
31
|
-
# Skeletons
|
|
32
|
-
|
|
33
|
-
This feature improves the store's experience and perceived performance through loading placeholders.
|
|
34
|
-
|
|
35
|
-
</header>
|
|
36
|
-
|
|
37
|
-
## Overview
|
|
38
|
-
|
|
39
|
-
`Skeletons` are like an element's or section's wireframe. It's a placeholder
|
|
40
|
-
that simulates the layout of these elements/sections while data is being loaded.
|
|
41
|
-
|
|
42
|
-
Instead of showing a blank page, displaying `Skeletons` while loading content makes the user feel like the store is more responsive and faster.
|
|
43
|
-
|
|
44
|
-
Also by using `Skeletons` the store will be less likely to experience [Cumulative Layout Shilf (or CLS)](https://web.dev/i18n/en/cls/).
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Usage
|
|
49
|
-
|
|
50
|
-
The `Skeleton` component is used as placeholder for the primitive elements (e.g. texts, buttons), being part of the related components.
|
|
51
|
-
|
|
52
|
-
`import Skeleton from 'src/components/skeletons/Skeleton'`
|
|
53
|
-
|
|
54
|
-
<Canvas className="canvas-skeletons">
|
|
55
|
-
<Story name="Usage" args={{ loading: true, shimmer: false, variant: 'text' }}>
|
|
56
|
-
{TemplateSkeleton.bind({})}
|
|
57
|
-
</Story>
|
|
58
|
-
</Canvas>
|
|
59
|
-
|
|
60
|
-
<ArgsTable story="Usage" />
|
|
61
|
-
|
|
62
|
-
<TokenTable>
|
|
63
|
-
<TokenRow
|
|
64
|
-
token="--fs-skeleton-bkg-color"
|
|
65
|
-
value="var(--fs-color-disabled-bkg)"
|
|
66
|
-
isColor
|
|
67
|
-
/>
|
|
68
|
-
<TokenRow
|
|
69
|
-
token="--fs-skeleton-border-radius"
|
|
70
|
-
value="var(--fs-border-radius)"
|
|
71
|
-
/>
|
|
72
|
-
</TokenTable>
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Variants
|
|
77
|
-
|
|
78
|
-
### Text
|
|
79
|
-
|
|
80
|
-
<Canvas className="canvas-skeletons">
|
|
81
|
-
<Story name="Text" args={{ loading: true, shimmer: true, variant: 'text' }}>
|
|
82
|
-
{TemplateSkeleton.bind({})}
|
|
83
|
-
</Story>
|
|
84
|
-
</Canvas>
|
|
85
|
-
|
|
86
|
-
<TokenTable>
|
|
87
|
-
<TokenRow token="--fs-skeleton-text-width" value="100%" />
|
|
88
|
-
<TokenRow token="--fs-skeleton-text-height" value="var(--fs-spacing-4)" />
|
|
89
|
-
</TokenTable>
|
|
90
|
-
|
|
91
|
-
### Button
|
|
92
|
-
|
|
93
|
-
<Canvas className="canvas-skeletons">
|
|
94
|
-
<Story
|
|
95
|
-
name="Button"
|
|
96
|
-
args={{ loading: true, shimmer: true, variant: 'button' }}
|
|
97
|
-
>
|
|
98
|
-
{TemplateSkeleton.bind({})}
|
|
99
|
-
</Story>
|
|
100
|
-
</Canvas>
|
|
101
|
-
|
|
102
|
-
<TokenTable>
|
|
103
|
-
<TokenRow token="--fs-skeleton-button-width" value="var(--fs-spacing-13)" />
|
|
104
|
-
<TokenRow token="--fs-skeleton-button-height" value="var(--fs-spacing-5)" />
|
|
105
|
-
<TokenRow token="--fs-skeleton-button-gap" value="var(--fs-spacing-2)" />
|
|
106
|
-
<TokenRow
|
|
107
|
-
token="--fs-skeleton-button-border-radius"
|
|
108
|
-
value="var(--fs-skeleton-border-radius)"
|
|
109
|
-
/>
|
|
110
|
-
</TokenTable>
|
|
111
|
-
|
|
112
|
-
### Image
|
|
113
|
-
|
|
114
|
-
<Canvas className="canvas-skeletons">
|
|
115
|
-
<Story name="Image" args={{ loading: true, shimmer: true, variant: 'image' }}>
|
|
116
|
-
{TemplateSkeleton.bind({})}
|
|
117
|
-
</Story>
|
|
118
|
-
</Canvas>
|
|
119
|
-
|
|
120
|
-
<TokenTable>
|
|
121
|
-
<TokenRow token="--fs-skeleton-image-height-mobile" value="45vw" />
|
|
122
|
-
<TokenRow token="--fs-skeleton-image-height-desktop" value="12.188rem" />
|
|
123
|
-
<TokenRow
|
|
124
|
-
token="--fs-skeleton-image-border-radius"
|
|
125
|
-
value="var(--fs-skeleton-border-radius)"
|
|
126
|
-
/>
|
|
127
|
-
</TokenTable>
|
|
128
|
-
|
|
129
|
-
### Badge
|
|
130
|
-
|
|
131
|
-
<Canvas className="canvas-skeletons">
|
|
132
|
-
<Story name="Badge" args={{ loading: true, shimmer: true, variant: 'badge' }}>
|
|
133
|
-
{TemplateSkeleton.bind({})}
|
|
134
|
-
</Story>
|
|
135
|
-
</Canvas>
|
|
136
|
-
|
|
137
|
-
<TokenTable>
|
|
138
|
-
<TokenRow token="--fs-skeleton-badge-height-mobile" value="45%" />
|
|
139
|
-
<TokenRow
|
|
140
|
-
token="--fs-skeleton-badge-height-desktop"
|
|
141
|
-
value="var(--fs-spacing-5)"
|
|
142
|
-
/>
|
|
143
|
-
<TokenRow
|
|
144
|
-
token="--fs-skeleton-badge-border-radius"
|
|
145
|
-
value="var(--fs-skeleton-border-radius)"
|
|
146
|
-
/>
|
|
147
|
-
</TokenTable>
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## Components
|
|
152
|
-
|
|
153
|
-
<SectionList grid="grid" classes="sbdocs-skeletons">
|
|
154
|
-
<SectionItem
|
|
155
|
-
title="Filter Skeleton"
|
|
156
|
-
actionPath="../?path=/docs/features-skeletons-filterskeleton--usage"
|
|
157
|
-
description={
|
|
158
|
-
<>
|
|
159
|
-
Loading placeholder for the <code>Filter</code> used in PLP.
|
|
160
|
-
</>
|
|
161
|
-
}
|
|
162
|
-
>
|
|
163
|
-
<FilterSkeleton loading />
|
|
164
|
-
</SectionItem>
|
|
165
|
-
<SectionItem
|
|
166
|
-
title="Product Card Skeleton"
|
|
167
|
-
actionPath="../?path=/docs/features-skeletons-productcardskeleton--usage"
|
|
168
|
-
description={
|
|
169
|
-
<>
|
|
170
|
-
Loading placeholder for the <code>ProductCard</code> used in several
|
|
171
|
-
sections of the store.
|
|
172
|
-
</>
|
|
173
|
-
}
|
|
174
|
-
>
|
|
175
|
-
<ProductCardSkeleton variant="wide" displayButton />
|
|
176
|
-
</SectionItem>
|
|
177
|
-
</SectionList>
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { Button, LinkButton } from '@faststore/ui'
|
|
4
|
-
|
|
5
|
-
import UIProvider, { useUI } from 'src/sdk/ui/Provider'
|
|
6
|
-
import { RegionalizationModalContent } from 'src/components/regionalization/RegionalizationModal'
|
|
7
|
-
|
|
8
|
-
import Modal from '.'
|
|
9
|
-
import Icon from '../Icon'
|
|
10
|
-
import {
|
|
11
|
-
TokenTable,
|
|
12
|
-
TokenRow,
|
|
13
|
-
TokenDivider,
|
|
14
|
-
} from 'src/../.storybook/components'
|
|
15
|
-
|
|
16
|
-
<Meta title="Molecules/Modal" component={Modal} />
|
|
17
|
-
|
|
18
|
-
export const ModalTemplate = (args) => {
|
|
19
|
-
const { modal, openModal } = useUI()
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<Button variant="primary" onClick={() => openModal()}>
|
|
23
|
-
Open Modal
|
|
24
|
-
</Button>
|
|
25
|
-
{modal && (
|
|
26
|
-
<Modal>
|
|
27
|
-
{({ fadeOut }) => (
|
|
28
|
-
<div
|
|
29
|
-
style={{
|
|
30
|
-
display: 'flex',
|
|
31
|
-
alignItems: 'center',
|
|
32
|
-
flexDirection: 'column',
|
|
33
|
-
padding: '3rem',
|
|
34
|
-
backgroundColor: 'white',
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
<h1
|
|
38
|
-
style={{
|
|
39
|
-
fontSize: '2rem',
|
|
40
|
-
paddingBottom: '1rem',
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
Hello, i'm a Modal!
|
|
44
|
-
</h1>
|
|
45
|
-
<Button onClick={fadeOut}>Close Modal</Button>
|
|
46
|
-
</div>
|
|
47
|
-
)}
|
|
48
|
-
</Modal>
|
|
49
|
-
)}
|
|
50
|
-
</div>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const Template = (args) => {
|
|
55
|
-
return (
|
|
56
|
-
<UIProvider>
|
|
57
|
-
<ModalTemplate />
|
|
58
|
-
</UIProvider>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
<header>
|
|
63
|
-
|
|
64
|
-
# Modal
|
|
65
|
-
|
|
66
|
-
Modals are dialog windows that sit on top of an application's main view. Once a Modal is open, interactions with the content behind it are blocked.
|
|
67
|
-
|
|
68
|
-
</header>
|
|
69
|
-
|
|
70
|
-
## Overview
|
|
71
|
-
|
|
72
|
-
The `Modal` component uses [FastStore UI Modal](https://www.faststore.dev/reference/ui/molecules/Modal) as base.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Usage
|
|
77
|
-
|
|
78
|
-
`import Modal from 'src/components/ui/Modal'`
|
|
79
|
-
|
|
80
|
-
<Canvas>
|
|
81
|
-
<Story name="Overview">{Template.bind({})}</Story>
|
|
82
|
-
</Canvas>
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
<TokenTable>
|
|
87
|
-
<TokenRow token="--fs-modal-position-top" value="30vh" />
|
|
88
|
-
<TokenRow token="--fs-modal-position-right" value="var(--fs-spacing-4)" />
|
|
89
|
-
<TokenRow token="--fs-modal-position-left" value="var(--fs-spacing-4)" />
|
|
90
|
-
<TokenRow
|
|
91
|
-
token="--fs-modal-max-width"
|
|
92
|
-
value="calc(var(--fs-grid-breakpoint-desktop) / 3)"
|
|
93
|
-
/>
|
|
94
|
-
<TokenRow token="--fs-modal-min-height" value="var(--fs-spacing-5)" />
|
|
95
|
-
<TokenRow token="--fs-modal-margin" value="auto" />
|
|
96
|
-
<TokenRow token="--fs-modal-border-radius" value="var(--fs-spacing-0)" />
|
|
97
|
-
<TokenDivider />
|
|
98
|
-
<TokenRow token="--fs-modal-width-tablet" value="calc(100vw / 3)" />
|
|
99
|
-
<TokenRow
|
|
100
|
-
token="--fs-modal-min-width-tablet"
|
|
101
|
-
value="calc(var(--fs-grid-breakpoint-desktop) / 3)"
|
|
102
|
-
/>
|
|
103
|
-
<TokenDivider />
|
|
104
|
-
<TokenRow
|
|
105
|
-
token="--fs-modal-transition-timing"
|
|
106
|
-
value="var(--fs-transition-timing)"
|
|
107
|
-
/>
|
|
108
|
-
<TokenRow token="--fs-modal-transition-property" value="transform" />
|
|
109
|
-
<TokenRow token="--fs-modal-transition-in-function" value="ease-in" />
|
|
110
|
-
<TokenRow token="--fs-modal-transition-out-function" value="ease-out" />
|
|
111
|
-
</TokenTable>
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Use Cases
|
|
116
|
-
|
|
117
|
-
<section className="sbdocs-list">
|
|
118
|
-
<ul className="sbdocs-ul-row">
|
|
119
|
-
<li>
|
|
120
|
-
<div>
|
|
121
|
-
<UIProvider>
|
|
122
|
-
<RegionalizationModalContent onClose={() => {}} />
|
|
123
|
-
</UIProvider>
|
|
124
|
-
</div>
|
|
125
|
-
<article className="sbdocs-list-text">
|
|
126
|
-
<h3>RegionalizationModal</h3>
|
|
127
|
-
<p>
|
|
128
|
-
It's the modal that, trigged by <code>RegionalizationButton</code> or{' '}
|
|
129
|
-
<code>RegionalizationBar</code>, shows the user the{' '}
|
|
130
|
-
<code>RegionalizationInput</code> search.
|
|
131
|
-
</p>
|
|
132
|
-
<LinkButton
|
|
133
|
-
size="small"
|
|
134
|
-
variant="tertiary"
|
|
135
|
-
href="../?path=/docs/features-regionalization-regionalizationmodal--overview"
|
|
136
|
-
icon={<Icon name="ArrowRight" width="18" height="18" weight="bold" />}
|
|
137
|
-
iconPosition="right"
|
|
138
|
-
>
|
|
139
|
-
See more
|
|
140
|
-
</LinkButton>
|
|
141
|
-
</article>
|
|
142
|
-
</li>
|
|
143
|
-
</ul>
|
|
144
|
-
</section>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ModalProps as UIModalProps } from '@faststore/ui'
|
|
2
|
-
import { Modal as UIModal } from '@faststore/ui'
|
|
3
|
-
import type { ReactNode } from 'react'
|
|
4
|
-
|
|
5
|
-
import { useUI } from 'src/sdk/ui/Provider'
|
|
6
|
-
import { useFadeEffect } from 'src/sdk/ui/useFadeEffect'
|
|
7
|
-
|
|
8
|
-
import styles from './modal.module.scss'
|
|
9
|
-
|
|
10
|
-
export type ModalChildrenProps = {
|
|
11
|
-
fade: 'in' | 'out'
|
|
12
|
-
fadeOut: () => void
|
|
13
|
-
fadeIn: () => void
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type ModalChildrenFunction = (props: ModalChildrenProps) => ReactNode
|
|
17
|
-
|
|
18
|
-
export type ModalProps = Omit<UIModalProps, 'isOpen' | 'children'> & {
|
|
19
|
-
children: ModalChildrenFunction | ReactNode
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function Modal({ className, children, ...props }: ModalProps) {
|
|
23
|
-
const { closeModal } = useUI()
|
|
24
|
-
const { fade, fadeOut, fadeIn } = useFadeEffect()
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<UIModal
|
|
28
|
-
onDismiss={fadeOut}
|
|
29
|
-
onTransitionEnd={() => fade === 'out' && closeModal()}
|
|
30
|
-
data-fs-modal
|
|
31
|
-
data-fs-modal-state={fade}
|
|
32
|
-
className={`${styles.fsModal} ${className}`}
|
|
33
|
-
{...props}
|
|
34
|
-
isOpen
|
|
35
|
-
>
|
|
36
|
-
{typeof children === 'function'
|
|
37
|
-
? children({ fade, fadeOut, fadeIn })
|
|
38
|
-
: children}
|
|
39
|
-
</UIModal>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default Modal
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Modal'
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
@import "src/styles/scaffold";
|
|
2
|
-
|
|
3
|
-
.fs-modal {
|
|
4
|
-
// --------------------------------------------------------
|
|
5
|
-
// Design Tokens for Modal
|
|
6
|
-
// --------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
// Default properties
|
|
9
|
-
--fs-modal-position-top : 30vh;
|
|
10
|
-
--fs-modal-position-right : var(--fs-spacing-4);
|
|
11
|
-
--fs-modal-position-left : var(--fs-spacing-4);
|
|
12
|
-
--fs-modal-max-width : calc(var(--fs-grid-breakpoint-desktop) / 3);
|
|
13
|
-
--fs-modal-min-height : var(--fs-spacing-5);
|
|
14
|
-
--fs-modal-margin : auto;
|
|
15
|
-
|
|
16
|
-
--fs-modal-width-tablet : calc(100vw / 3);
|
|
17
|
-
--fs-modal-min-width-tablet : calc(var(--fs-grid-breakpoint-desktop) / 3);
|
|
18
|
-
|
|
19
|
-
--fs-modal-transition-timing : var(--fs-transition-timing);
|
|
20
|
-
--fs-modal-transition-property : transform;
|
|
21
|
-
--fs-modal-transition-in-function : ease-in;
|
|
22
|
-
--fs-modal-transition-out-function : ease-in;
|
|
23
|
-
|
|
24
|
-
position: fixed;
|
|
25
|
-
top: var(--fs-modal-position-top);
|
|
26
|
-
right: var(--fs-modal-position-right);
|
|
27
|
-
left: var(--fs-modal-position-left);
|
|
28
|
-
max-width: var(--fs-modal-max-width);
|
|
29
|
-
min-height: var(--fs-modal-min-height);
|
|
30
|
-
margin: var(--fs-modal-margin);
|
|
31
|
-
|
|
32
|
-
@include media(">=tablet") {
|
|
33
|
-
width: var(--fs-modal-width-tablet);
|
|
34
|
-
min-width: var(--fs-modal-min-width-tablet);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&[data-fs-modal-state="in"] {
|
|
38
|
-
transition: var(--fs-modal-transition-property) var(--fs-modal-transition-timing) var(--fs-modal-transition-in-function);
|
|
39
|
-
transform: translate3d(0, 0, 0);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&[data-fs-modal-state="out"] {
|
|
43
|
-
transition: var(--fs-modal-transition-property) var(--fs-modal-transition-timing) var(--fs-modal-transition-in-function);
|
|
44
|
-
transform: translate3d(0, 50%, 0);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { DiscountBadge } from '@faststore/ui'
|
|
4
|
-
import ProductTitle from '.'
|
|
5
|
-
import { TokenTable, TokenRow } from 'src/../.storybook/components'
|
|
6
|
-
|
|
7
|
-
<Meta
|
|
8
|
-
title="Molecules/ProductTitle"
|
|
9
|
-
component={ProductTitle}
|
|
10
|
-
argTypes={{
|
|
11
|
-
title: {
|
|
12
|
-
control: { type: 'radio' },
|
|
13
|
-
options: [
|
|
14
|
-
'<h1>Apple Magic Mouse</h1>',
|
|
15
|
-
'<h2>Apple Magic Mouse</h2>',
|
|
16
|
-
'<h3>Apple Magic Mouse</h3>',
|
|
17
|
-
],
|
|
18
|
-
mapping: {
|
|
19
|
-
'<h1>Apple Magic Mouse</h1>': <h1>Apple Magic Mouse</h1>,
|
|
20
|
-
'<h2>Apple Magic Mouse</h2>': <h2>Apple Magic Mouse</h2>,
|
|
21
|
-
'<h3>Apple Magic Mouse</h3>': <h3>Apple Magic Mouse</h3>,
|
|
22
|
-
},
|
|
23
|
-
defaultValue: '<h1>Apple Magic Mouse</h1>',
|
|
24
|
-
},
|
|
25
|
-
label: {
|
|
26
|
-
control: { type: 'radio' },
|
|
27
|
-
options: [
|
|
28
|
-
'<DiscountBadge listPrice={100} spotPrice={90} size="big" />',
|
|
29
|
-
'<DiscountBadge listPrice={100} spotPrice={70} size="big" />',
|
|
30
|
-
'<DiscountBadge listPrice={100} spotPrice={10} size="big" />',
|
|
31
|
-
],
|
|
32
|
-
mapping: {
|
|
33
|
-
'<DiscountBadge listPrice={100} spotPrice={90} size="big" />': (
|
|
34
|
-
<DiscountBadge listPrice={100} spotPrice={90} size="big" />
|
|
35
|
-
),
|
|
36
|
-
'<DiscountBadge listPrice={100} spotPrice={70} size="big" />': (
|
|
37
|
-
<DiscountBadge listPrice={100} spotPrice={70} size="big" />
|
|
38
|
-
),
|
|
39
|
-
'<DiscountBadge listPrice={100} spotPrice={10} size="big" />': (
|
|
40
|
-
<DiscountBadge listPrice={100} spotPrice={10} size="big" />
|
|
41
|
-
),
|
|
42
|
-
},
|
|
43
|
-
defaultValue:
|
|
44
|
-
'<DiscountBadge listPrice={100} spotPrice={90} size="big" />',
|
|
45
|
-
},
|
|
46
|
-
refNumber: {
|
|
47
|
-
defaultValue: '99995945',
|
|
48
|
-
},
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
export const Template = (args) => <ProductTitle {...args} />
|
|
53
|
-
|
|
54
|
-
<header>
|
|
55
|
-
|
|
56
|
-
# Product Title
|
|
57
|
-
|
|
58
|
-
The product title that is commonly used on Product Details Page (PDP).
|
|
59
|
-
|
|
60
|
-
</header>
|
|
61
|
-
|
|
62
|
-
## Usage
|
|
63
|
-
|
|
64
|
-
`import ProductTitle from '../components/ui/ProductTitle'`
|
|
65
|
-
|
|
66
|
-
<Canvas>
|
|
67
|
-
<Story name="Default">{Template.bind({})}</Story>
|
|
68
|
-
</Canvas>
|
|
69
|
-
|
|
70
|
-
<ArgsTable story="Default" />
|
|
71
|
-
|
|
72
|
-
<TokenTable>
|
|
73
|
-
<TokenRow
|
|
74
|
-
token="--fs-product-title-text-size"
|
|
75
|
-
value="var(--fs-text-size-title-product)"
|
|
76
|
-
/>
|
|
77
|
-
<TokenRow
|
|
78
|
-
token="--fs-product-title-text-weight"
|
|
79
|
-
value="var(--fs-text-weight-regular)"
|
|
80
|
-
/>
|
|
81
|
-
<TokenRow token="--fs-product-title-line-height" value="1.12" />
|
|
82
|
-
</TokenTable>
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Nested Elements
|
|
87
|
-
|
|
88
|
-
### Addendum
|
|
89
|
-
|
|
90
|
-
<TokenTable>
|
|
91
|
-
<TokenRow
|
|
92
|
-
token="--fs-product-title-addendum-margin-top"
|
|
93
|
-
value="var(--fs-spacing-3)"
|
|
94
|
-
/>
|
|
95
|
-
<TokenRow
|
|
96
|
-
token="--fs-product-title-addendum-color"
|
|
97
|
-
value="var(--fs-color-text-light)"
|
|
98
|
-
isColor
|
|
99
|
-
/>
|
|
100
|
-
<TokenRow
|
|
101
|
-
token="--fs-product-title-addendum-size"
|
|
102
|
-
value="var(--fs-text-size-1)"
|
|
103
|
-
/>
|
|
104
|
-
<TokenRow token="--fs-product-title-addendum-line-height" value="1.7" />
|
|
105
|
-
</TokenTable>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react'
|
|
2
|
-
import type { ProductTitleProps } from '@faststore/ui'
|
|
3
|
-
import { ProductTitle as UIProductTitle } from '@faststore/ui'
|
|
4
|
-
|
|
5
|
-
import styles from './product-title.module.scss'
|
|
6
|
-
|
|
7
|
-
function ProductTitle({ ...otherProps }: ProductTitleProps) {
|
|
8
|
-
return <UIProductTitle className={styles.fsProductTitle} {...otherProps} />
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default memo(ProductTitle)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ProductTitle'
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
@import "src/styles/scaffold";
|
|
2
|
-
|
|
3
|
-
.fs-product-title {
|
|
4
|
-
// --------------------------------------------------------
|
|
5
|
-
// Design Tokens for ProductTitle
|
|
6
|
-
// --------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
// Default properties
|
|
9
|
-
--fs-product-title-text-size : var(--fs-text-size-title-product);
|
|
10
|
-
--fs-product-title-text-weight : var(--fs-text-weight-regular);
|
|
11
|
-
--fs-product-title-line-height : 1.12;
|
|
12
|
-
|
|
13
|
-
--fs-product-title-addendum-margin-top : var(--fs-spacing-3);
|
|
14
|
-
--fs-product-title-addendum-color : var(--fs-color-text-light);
|
|
15
|
-
--fs-product-title-addendum-size : var(--fs-text-size-1);
|
|
16
|
-
--fs-product-title-addendum-line-height : 1.7;
|
|
17
|
-
|
|
18
|
-
// --------------------------------------------------------
|
|
19
|
-
// Structural Styles
|
|
20
|
-
// --------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
[data-fs-product-title-header] {
|
|
23
|
-
display: flex;
|
|
24
|
-
column-gap: var(--fs-spacing-2);
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
|
|
27
|
-
// Title prop
|
|
28
|
-
&:first-child {
|
|
29
|
-
font-size: var(--fs-product-title-text-size);
|
|
30
|
-
font-weight: var(--fs-product-title-text-weight);
|
|
31
|
-
line-height: var(--fs-product-title-line-height);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[data-fs-badge] { white-space: nowrap; }
|
|
35
|
-
|
|
36
|
-
@include media(">=tablet", "<notebook") {
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
row-gap: var(--fs-spacing-3);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[data-fs-product-title-addendum] {
|
|
43
|
-
margin-top: var(--fs-product-title-addendum-margin-top);
|
|
44
|
-
font-size: var(--fs-product-title-addendum-size);
|
|
45
|
-
line-height: var(--fs-product-title-addendum-line-height);
|
|
46
|
-
color: var(--fs-product-title-addendum-color);
|
|
47
|
-
}
|
|
48
|
-
}
|