-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style Guide for HTML and CSS added; JS and React stubbed
- Loading branch information
1 parent
40e74a9
commit 002da23
Showing
8 changed files
with
14,100 additions
and
9,549 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,82 @@ | ||
import React from 'react'; | ||
import Typography from '@mui/material/Typography'; | ||
import Divider from '@mui/material/Divider'; | ||
import SyntaxHighlighter from 'react-syntax-highlighter'; | ||
import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/hljs'; | ||
|
||
export const Body = (props) => { | ||
return ( | ||
<Typography {...props} variant="body1" style={{ padding: '10px 0'}}> | ||
{props.children} | ||
</Typography> | ||
) | ||
} | ||
|
||
export const H3 = (props) => { | ||
return ( | ||
<Typography id={props.id} {...props} variant="h4" component="div" gutterBottom> | ||
{props.children} | ||
</Typography> | ||
); | ||
} | ||
|
||
export const H5 = (props) => { | ||
return ( | ||
<Typography id={props.id} {...props} variant="h5" component="div" gutterBottom> | ||
{props.children} | ||
</Typography> | ||
); | ||
} | ||
|
||
export const HR = () => { | ||
return <Divider sx={{ mb: 3, mt: 3, }} /> | ||
} | ||
|
||
export const Code = (props) => { | ||
{/*<div style={{ maxWidth: props.large ? '100%' : props.medium ? '800px' : '500px' }}>*/} | ||
return ( | ||
<div style={{ maxWidth: '800px' }}> | ||
<SyntaxHighlighter | ||
style={a11yDark} | ||
language={props.lang} | ||
> | ||
{props.children} | ||
</SyntaxHighlighter> | ||
</div> | ||
) | ||
} | ||
|
||
export const Example = (props) => { | ||
const [expand, setExpand] = React.useState(true); | ||
return ( | ||
<> | ||
<Body onClick={() => setExpand(!expand)}> | ||
<span style={{ cursor: 'pointer' }}> | ||
{expand ? '⬇️' : '⬆️'} 💡 <b>Example: </b> | ||
</span> | ||
</Body> | ||
{expand ? ( | ||
<div style={{ marginLeft: '20px', marginBottom: '20px'}}> | ||
{props.bads && props.bads.map((bad, idx) => { | ||
return ( | ||
<> | ||
<Body tyle={{paddingTop: '20px'}} key={idx}><b>🔴 Bad</b></Body> | ||
<Code lang={props.lang} large={props.large} medium={props.medium}>{bad}</Code> | ||
</> | ||
) | ||
})} | ||
{props.goods && props.goods.map((good, idx) => { | ||
return ( | ||
<> | ||
<Body style={{paddingTop: '20px'}} key={idx}><b> 🟢 Good</b></Body> | ||
<Code lang={props.lang} large={props.large} medium={props.medium}>{good}</Code> | ||
</> | ||
) | ||
})} | ||
</div> | ||
) : ( | ||
<div style={{ marginLeft: '20px' }}>...</div> | ||
)} | ||
</> | ||
) | ||
} |
Oops, something went wrong.