-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components/molecule/collapsible): Custom toggle button and butto…
…n alignment
- Loading branch information
1 parent
f924d16
commit ea080b0
Showing
8 changed files
with
136 additions
and
15 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
73 changes: 73 additions & 0 deletions
73
components/molecule/collapsible/demo/ArticleCustomToggleButton.js
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,73 @@ | ||
import PropTypes from 'prop-types' | ||
|
||
import {Article, Code, H2, Paragraph} from '@s-ui/documentation-library' | ||
import Button, { | ||
atomButtonDesigns, | ||
atomButtonShapes, | ||
atomButtonSizes | ||
} from '@s-ui/react-atom-button' | ||
|
||
import MoleculeCollapsible from '../src/index.js' | ||
import {DemoWrapper, Text} from './config/index.js' | ||
|
||
const ArticleCustomToggleButton = ({className, icon, showText, hideText}) => { | ||
const ToggleButton = props => { | ||
return ( | ||
<div style={{paddingTop: '12px'}}> | ||
<Button | ||
{...props} | ||
shape={atomButtonShapes.CIRCULAR} | ||
design={atomButtonDesigns.OUTLINE} | ||
size={atomButtonSizes.SMALL} | ||
role="button" | ||
></Button> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<Article className={className}> | ||
<H2>Collapsible Gradient</H2> | ||
<Paragraph> | ||
The prop <Code>toggleButton</Code> accepts a custom component to toggle | ||
collapse | ||
</Paragraph> | ||
<br /> | ||
<br /> | ||
<DemoWrapper> | ||
<div style={{display: 'flex', flexDirection: 'column'}}> | ||
<span>Custom toggle button</span> | ||
<div | ||
style={{ | ||
backgroundColor: '#fff', | ||
fontSize: 14, | ||
padding: 16, | ||
textAlign: 'left', | ||
maxWidth: 400 | ||
}} | ||
> | ||
<MoleculeCollapsible | ||
icon={icon} | ||
showText={showText} | ||
hideText={hideText} | ||
toggleButton={ToggleButton} | ||
withGradient={false} | ||
alignButton="center" | ||
> | ||
<Text /> | ||
</MoleculeCollapsible> | ||
</div> | ||
</div> | ||
</DemoWrapper> | ||
</Article> | ||
) | ||
} | ||
|
||
ArticleCustomToggleButton.propTypes = { | ||
className: PropTypes.string, | ||
icon: PropTypes.node, | ||
showText: PropTypes.string, | ||
hideText: PropTypes.string | ||
} | ||
|
||
export default ArticleCustomToggleButton |
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
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,2 @@ | ||
@import '~@s-ui/react-atom-button/lib/index'; | ||
@import '../src/index.scss'; |
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
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