Skip to content

Commit 10c5553

Browse files
committed
Add tooltips to code example actions.
1 parent e02c39c commit 10c5553

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import clsx from 'clsx';
1515
import grey from '@material-ui/core/colors/grey';
1616
import IconButton from '@material-ui/core/IconButton';
1717
import { getParameters } from 'codesandbox/lib/api/define';
18+
import Tooltip from '@material-ui/core/Tooltip';
1819

1920
import GhIcon from './common/gh-svg-icon';
2021
import CodesandboxIcon from './common/code-sandbox-svg-icon';
@@ -150,7 +151,16 @@ const CodeExample = ({ source, mode }) => {
150151
<Grid container spacing={0} className="DocRawComponent">
151152
<Grid item xs={12}>
152153
<ExpansionPanel className={classes.expansionPanel}>
153-
<ExpansionPanelSummary className={classes.expansionPanelSummary} expandIcon={<CodeIcon />}>
154+
<ExpansionPanelSummary
155+
className={classes.expansionPanelSummary}
156+
expandIcon={
157+
<Tooltip title="Expand code example">
158+
<IconButton>
159+
<CodeIcon />
160+
</IconButton>
161+
</Tooltip>
162+
}
163+
>
154164
{Component && (
155165
<Typography className={classes.heading} component="h4" variant="h3">
156166
{Component.name}
@@ -159,9 +169,11 @@ const CodeExample = ({ source, mode }) => {
159169
<Box display="flex">
160170
<form action="https://codesandbox.io/api/v1/sandboxes/define" method="POST" target="_blank">
161171
<input type="hidden" name="parameters" value={getPayload('pf4', codeSource)} />
162-
<IconButton disableFocusRipple type="submit">
163-
<CodesandboxIcon />
164-
</IconButton>
172+
<Tooltip title="Edit in codesandbox">
173+
<IconButton disableFocusRipple type="submit">
174+
<CodesandboxIcon />
175+
</IconButton>
176+
</Tooltip>
165177
</form>
166178
<Link
167179
component="button"
@@ -170,7 +182,11 @@ const CodeExample = ({ source, mode }) => {
170182
rel="noopener noreferrer"
171183
onClick={(event) => event.stopPropagation()}
172184
>
173-
<GhIcon style={{ color: grey[700] }} />
185+
<Tooltip title="View source on github">
186+
<IconButton>
187+
<GhIcon style={{ color: grey[700] }} />
188+
</IconButton>
189+
</Tooltip>
174190
</Link>
175191
</Box>
176192
</ExpansionPanelSummary>

0 commit comments

Comments
 (0)