Skip to content

Commit e02c39c

Browse files
committed
Added styling to the codesandbox link.
1 parent e33b359 commit e02c39c

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

packages/react-renderer-demo/src/app/src/components/code-example.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
1313
import Paper from '@material-ui/core/Paper';
1414
import clsx from 'clsx';
1515
import grey from '@material-ui/core/colors/grey';
16+
import IconButton from '@material-ui/core/IconButton';
1617
import { getParameters } from 'codesandbox/lib/api/define';
1718

1819
import GhIcon from './common/gh-svg-icon';
20+
import CodesandboxIcon from './common/code-sandbox-svg-icon';
1921

2022
const CodeEditor = dynamic(import('./code-editor'), {
2123
ssr: false
@@ -35,9 +37,11 @@ const useStyles = makeStyles((theme) => ({
3537
padding: 16
3638
},
3739
heading: {
38-
fontSize: theme.typography.pxToRem(15),
40+
fontSize: theme.typography.pxToRem(20),
3941
fontWeight: theme.typography.fontWeightRegular,
40-
flexGrow: 1
42+
flexGrow: 1,
43+
display: 'flex',
44+
alignItems: 'center'
4145
},
4246
secondaryHeading: {
4347
fontSize: theme.typography.pxToRem(15),
@@ -147,13 +151,20 @@ const CodeExample = ({ source, mode }) => {
147151
<Grid item xs={12}>
148152
<ExpansionPanel className={classes.expansionPanel}>
149153
<ExpansionPanelSummary className={classes.expansionPanelSummary} expandIcon={<CodeIcon />}>
150-
{Component && <Typography className={classes.heading}>{Component.name}</Typography>}
154+
{Component && (
155+
<Typography className={classes.heading} component="h4" variant="h3">
156+
{Component.name}
157+
</Typography>
158+
)}
151159
<Box display="flex">
152160
<form action="https://codesandbox.io/api/v1/sandboxes/define" method="POST" target="_blank">
153161
<input type="hidden" name="parameters" value={getPayload('pf4', codeSource)} />
154-
<input type="submit" value="Open in sandbox" />
162+
<IconButton disableFocusRipple type="submit">
163+
<CodesandboxIcon />
164+
</IconButton>
155165
</form>
156166
<Link
167+
component="button"
157168
href={`https://github.com/data-driven-forms/react-forms/tree/master/packages/react-renderer-demo/src/app/examples/${source}.js`}
158169
target="_blank"
159170
rel="noopener noreferrer"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* eslint-disable max-len */
2+
import React from 'react';
3+
import SvgIcon from '@material-ui/core/SvgIcon';
4+
5+
const CodesandboxIcon = (props) => (
6+
<SvgIcon {...props} viewBox="0 0 24 24" role="presentation">
7+
<path d="M2 6l10.455-6L22.91 6 23 17.95 12.455 24 2 18V6zm2.088 2.481v4.757l3.345 1.86v3.516l3.972 2.296v-8.272L4.088 8.481zm16.739 0l-7.317 4.157v8.272l3.972-2.296V15.1l3.345-1.861V8.48zM5.134 6.601l7.303 4.144 7.32-4.18-3.871-2.197-3.41 1.945-3.43-1.968L5.133 6.6z" />
8+
</SvgIcon>
9+
);
10+
11+
export default CodesandboxIcon;

0 commit comments

Comments
 (0)