-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(motion): Collapse
orientation
param & horizontal implementation (
- Loading branch information
1 parent
04dd27b
commit 46cdc69
Showing
6 changed files
with
110 additions
and
11 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-motion-components-preview-e49e73e0-27c3-4285-baf8-2ca1d7fc8efd.json
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,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "feat: add Collapse orientation parameter & horizontal implementation", | ||
"packageName": "@fluentui/react-motion-components-preview", | ||
"email": "robertpenner@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
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
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
5 changes: 5 additions & 0 deletions
5
...ct-motion-components-preview/stories/src/Collapse/CollapseHorizontal.stories.md
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,5 @@ | ||
For a horizontal `Collapse`, set the `orientation` parameter: | ||
|
||
```tsx | ||
<Collapse orientation="horizontal" ...> | ||
``` |
77 changes: 77 additions & 0 deletions
77
...nents/react-motion-components-preview/stories/src/Collapse/CollapseHorizontal.stories.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,77 @@ | ||
import { Field, makeStyles, tokens, Switch } from '@fluentui/react-components'; | ||
import { Collapse } from '@fluentui/react-motion-components-preview'; | ||
import * as React from 'react'; | ||
|
||
import description from './CollapseHorizontal.stories.md'; | ||
|
||
const useClasses = makeStyles({ | ||
container: {}, | ||
sideContent: { | ||
background: 'lightgrey', | ||
padding: '50px', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
card: { | ||
gridArea: 'card', | ||
padding: '20px', | ||
width: '300px', | ||
}, | ||
controls: { | ||
display: 'grid', | ||
gridTemplateColumns: '1fr 3fr', | ||
justifyContent: 'start', | ||
gridArea: 'controls', | ||
border: `${tokens.strokeWidthThicker} solid ${tokens.colorNeutralForeground3}`, | ||
borderRadius: tokens.borderRadiusMedium, | ||
boxShadow: tokens.shadow16, | ||
padding: '10px', | ||
}, | ||
field: { | ||
flex: 1, | ||
}, | ||
}); | ||
|
||
const LoremIpsum = () => ( | ||
<> | ||
{'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. '.repeat( | ||
3, | ||
)} | ||
</> | ||
); | ||
|
||
export const Horizontal = () => { | ||
const classes = useClasses(); | ||
const [visible, setVisible] = React.useState<boolean>(false); | ||
|
||
return ( | ||
<div className={classes.container}> | ||
<div className={classes.controls}> | ||
<Field className={classes.field}> | ||
<Switch label="Visible" checked={visible} onChange={() => setVisible(v => !v)} /> | ||
</Field> | ||
</div> | ||
|
||
<div style={{ display: 'flex' }}> | ||
<Collapse visible={visible} orientation="horizontal"> | ||
{/* Wrapper div to make the collapse crop the card without reflowing the text. */} | ||
<div> | ||
<div className={classes.card}> | ||
<LoremIpsum /> | ||
</div> | ||
</div> | ||
</Collapse> | ||
<div className={classes.sideContent}>[side content]</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
Horizontal.parameters = { | ||
docs: { | ||
description: { | ||
story: description, | ||
}, | ||
}, | ||
}; |
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