-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs(web-react): Add ScrollView demo #DS-906
- ScrollView demo in web-react is now same as demo in web and web-twig
- Loading branch information
1 parent
01211cb
commit cd08338
Showing
11 changed files
with
149 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
packages/web-react/src/components/ScrollView/demo/ScrollView.tsx
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
packages/web-react/src/components/ScrollView/demo/ScrollViewDefault.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import ScrollView from '../ScrollView'; | ||
import { VERTICAL_CONTENT } from './scrollViewContent'; | ||
|
||
const ScrollViewDefault = () => ( | ||
<div style={{ height: '160px' }}> | ||
<ScrollView data-spirit-toggle="scrollView"> | ||
<p>{VERTICAL_CONTENT}</p> | ||
</ScrollView> | ||
</div> | ||
); | ||
|
||
export default ScrollViewDefault; |
19 changes: 19 additions & 0 deletions
19
packages/web-react/src/components/ScrollView/demo/ScrollViewHiddenScrollbar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import ScrollView from '../ScrollView'; | ||
import { VERTICAL_CONTENT, HORIZONTAL_CONTENT } from './scrollViewContent'; | ||
|
||
const ScrollViewHiddenScrollbar = () => ( | ||
<> | ||
<div className="mb-1000" style={{ height: '160px' }}> | ||
<ScrollView isScrollbarDisabled> | ||
<p>{VERTICAL_CONTENT}</p> | ||
</ScrollView> | ||
</div> | ||
|
||
<ScrollView direction="horizontal" isScrollbarDisabled> | ||
<p style={{ whiteSpace: 'nowrap' }}>{HORIZONTAL_CONTENT}</p> | ||
</ScrollView> | ||
</> | ||
); | ||
|
||
export default ScrollViewHiddenScrollbar; |
41 changes: 7 additions & 34 deletions
41
packages/web-react/src/components/ScrollView/demo/ScrollViewHorizontal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,13 @@ | ||
import React from 'react'; | ||
import { ComponentStory } from '@storybook/react'; | ||
import ScrollView from '../ScrollView'; | ||
import { SpiritScrollViewProps } from '../../../types'; | ||
import { HORIZONTAL_CONTENT } from './scrollViewContent'; | ||
|
||
const Story: ComponentStory<typeof ScrollView> = (args: SpiritScrollViewProps) => <ScrollView {...args} />; | ||
|
||
Story.args = { | ||
direction: 'horizontal', | ||
children: ( | ||
const ScrollViewHorizontal = () => ( | ||
<ScrollView direction="horizontal"> | ||
<p className="py-700" style={{ whiteSpace: 'nowrap' }}> | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum | ||
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, | ||
pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, | ||
vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede | ||
mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. | ||
Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, | ||
feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam | ||
ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, | ||
tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, | ||
blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien | ||
ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed | ||
fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue | ||
velit cursus nunc.Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus | ||
mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec | ||
pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis | ||
vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum | ||
semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, | ||
enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius | ||
laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. | ||
Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet | ||
adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec | ||
odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet | ||
orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed | ||
consequat, leo eget bibendum sodales, augue velit cursus nunc. | ||
{HORIZONTAL_CONTENT} | ||
</p> | ||
), | ||
}; | ||
</ScrollView> | ||
); | ||
|
||
export default Story; | ||
export default ScrollViewHorizontal; |
20 changes: 20 additions & 0 deletions
20
packages/web-react/src/components/ScrollView/demo/ScrollViewHorizontalBreakout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import DocsBox from '../../../../docs/DocsBox'; | ||
import { Grid } from '../../Grid'; | ||
import ScrollView from '../ScrollView'; | ||
|
||
const ScrollViewHorizontalBreakout = () => ( | ||
<div className="breakout-container"> | ||
<ScrollView direction="horizontal"> | ||
<Grid cols={4} UNSAFE_className="mb-700" UNSAFE_style={{ paddingInline: 'var(--container-padding-inline)' }}> | ||
{[1, 2, 3, 4].map((i) => ( | ||
<DocsBox key={i} size="small" UNSAFE_style={{ width: '20rem', aspectRatio: '2/1' }}> | ||
1/4 | ||
</DocsBox> | ||
))} | ||
</Grid> | ||
</ScrollView> | ||
</div> | ||
); | ||
|
||
export default ScrollViewHorizontalBreakout; |
33 changes: 33 additions & 0 deletions
33
packages/web-react/src/components/ScrollView/demo/ScrollViewOverflowDecorators.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import ScrollView from '../ScrollView'; | ||
import { VERTICAL_CONTENT, HORIZONTAL_CONTENT } from './scrollViewContent'; | ||
|
||
const ScrollViewOverflowDecorators = () => ( | ||
<> | ||
<div className="mb-1000" style={{ height: '160px' }}> | ||
<ScrollView overflowDecorators="borders"> | ||
<p>{VERTICAL_CONTENT}</p> | ||
</ScrollView> | ||
</div> | ||
|
||
<ScrollView direction="horizontal" overflowDecorators="borders" UNSAFE_className="mb-1000"> | ||
<p className="py-700" style={{ whiteSpace: 'nowrap' }}> | ||
{HORIZONTAL_CONTENT} | ||
</p> | ||
</ScrollView> | ||
|
||
<div className="mb-1000" style={{ height: '160px' }}> | ||
<ScrollView overflowDecorators="both"> | ||
<p>{VERTICAL_CONTENT}</p> | ||
</ScrollView> | ||
</div> | ||
|
||
<ScrollView direction="horizontal" overflowDecorators="both"> | ||
<p className="py-700" style={{ whiteSpace: 'nowrap' }}> | ||
{HORIZONTAL_CONTENT} | ||
</p> | ||
</ScrollView> | ||
</> | ||
); | ||
|
||
export default ScrollViewOverflowDecorators; |
55 changes: 0 additions & 55 deletions
55
packages/web-react/src/components/ScrollView/demo/ScrollViewScrollbarDisabled.tsx
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
packages/web-react/src/components/ScrollView/demo/argTypes.ts
This file was deleted.
Oops, something went wrong.
24 changes: 16 additions & 8 deletions
24
packages/web-react/src/components/ScrollView/demo/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import DocsSection from '../../../../docs/DocsSections'; | ||
import ScrollView from './ScrollView'; | ||
import ScrollViewDefault from './ScrollViewDefault'; | ||
import ScrollViewHorizontal from './ScrollViewHorizontal'; | ||
import ScrollViewScrollbarDisabled from './ScrollViewScrollbarDisabled'; | ||
import ScrollViewHorizontalBreakout from './ScrollViewHorizontalBreakout'; | ||
import ScrollViewOverflowDecorators from './ScrollViewOverflowDecorators'; | ||
import ScrollViewHiddenScrollbar from './ScrollViewHiddenScrollbar'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( | ||
<React.StrictMode> | ||
<DocsSection title="Default"> | ||
<ScrollView {...ScrollView.args} /> | ||
<DocsSection title="Vertical Scrolling"> | ||
<ScrollViewDefault /> | ||
</DocsSection> | ||
<DocsSection title="Horizontal"> | ||
<ScrollViewHorizontal {...ScrollViewHorizontal.args} /> | ||
<DocsSection title="Horizontal Scrolling"> | ||
<ScrollViewHorizontal /> | ||
</DocsSection> | ||
<DocsSection title="Scrollbar Disabled"> | ||
<ScrollViewScrollbarDisabled {...ScrollViewScrollbarDisabled.args} /> | ||
<DocsSection title="Horizontal Scrolling with Container Breakout" hasStack={false}> | ||
<ScrollViewHorizontalBreakout /> | ||
</DocsSection> | ||
<DocsSection title="Overflow Decorators"> | ||
<ScrollViewOverflowDecorators /> | ||
</DocsSection> | ||
<DocsSection title="Hidden Scrollbar"> | ||
<ScrollViewHiddenScrollbar /> | ||
</DocsSection> | ||
</React.StrictMode>, | ||
); |
Oops, something went wrong.