-
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): Introduce DocsBox component
- Loading branch information
1 parent
2feb782
commit ec381f7
Showing
2 changed files
with
23 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { ReactNode } from 'react'; | ||
import { SizesDictionaryType } from '../src/types'; | ||
|
||
interface DocsBoxProps { | ||
children: ReactNode; | ||
size?: SizesDictionaryType; | ||
} | ||
|
||
const defaultProps = { | ||
size: 'medium', | ||
}; | ||
|
||
const DocsBox = ({ children, size }: DocsBoxProps) => { | ||
const sizeClass = size ? `docs-Box--${size}` : ''; | ||
|
||
return <div className={`docs-Box ${sizeClass}`}>{children}</div>; | ||
}; | ||
|
||
DocsBox.defaultProps = defaultProps; | ||
|
||
export default DocsBox; |
5 changes: 2 additions & 3 deletions
5
packages/web-react/src/components/Container/demo/ContainerDefault.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,7 +1,6 @@ | ||
import React from 'react'; | ||
import DocsBox from '../../../../docs/DocsBox'; | ||
|
||
const ContainerDefault = () => { | ||
return <div className="docs-Box">Container</div>; | ||
}; | ||
const ContainerDefault = () => <DocsBox>Container</DocsBox>; | ||
|
||
export default ContainerDefault; |