-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
94 additions
and
32 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
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 |
---|---|---|
@@ -1,14 +1,34 @@ | ||
// @flow | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import Code from 'react-syntax-highlighter'; | ||
|
||
type DemoProps = { | ||
children?: any; | ||
demo: ReactClass<*>; | ||
source: string; | ||
}; | ||
|
||
const Demo: ReactClass<DemoProps> = styled.div` | ||
const DemoContainer = styled.div` | ||
border: 1px solid #aaa; | ||
padding: 20px; | ||
margin-top: 20px; | ||
margin-bottom: 20px; | ||
font-size: 14px; | ||
`; | ||
|
||
export default Demo; | ||
export default function Demo({ children, demo, source }: DemoProps): React.Element<*> { | ||
const DemoComponent = demo; | ||
return ( | ||
<div> | ||
<DemoContainer> | ||
{DemoComponent | ||
? <DemoComponent /> | ||
: children} | ||
</DemoContainer> | ||
{source && <Code language='javascript'> | ||
{source} | ||
</Code>} | ||
</div> | ||
); | ||
} |
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
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