Skip to content

Commit 2e0cf96

Browse files
committed
Fixed invalid props passed to link in mapper tabs.
1 parent 012d15f commit 2e0cf96

File tree

2 files changed

+41
-24
lines changed

2 files changed

+41
-24
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ const CodeExample = ({ source, mode, mapper }) => {
237237
CodeExample.propTypes = {
238238
source: PropTypes.string.isRequired,
239239
mode: PropTypes.oneOf(['code', 'preview']),
240-
mapper: PropTypes.oneOf(['pf4', 'mui']),
241-
additionalSources: PropTypes.string // this has to be a string, MDX does not pass objects/arrays
240+
mapper: PropTypes.oneOf(['pf4', 'mui'])
242241
};
243242

244243
CodeExample.defaultProps = {

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

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ const project = {
3636

3737
const useStyles = makeStyles((theme) => ({
3838
tab: {
39-
minWidth: 'initial'
39+
minWidth: 'initial',
40+
'&.active': {
41+
color: '#000',
42+
background: theme.palette.common.white,
43+
boxShadow: theme.shadows[1]
44+
}
4045
},
4146
indicator: {
4247
width: 4
4348
},
4449
tabLink: {
4550
textDecoration: 'none',
46-
color: 'inherit',
47-
'&.active': {
48-
color: '#000',
49-
background: theme.palette.common.white,
50-
boxShadow: theme.shadows[1]
51-
}
51+
color: 'inherit'
5252
},
5353
editorContainer: {
5454
height: '100%',
@@ -148,21 +148,39 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
148148
indicator: classes.indicator
149149
}}
150150
>
151-
<Link href={`${router.pathname}?mapper=mui`}>
152-
<a href={`${router.pathname}?mapper=mui`} className={clsx(classes.tabLink, { active: activeTab === 0 })}>
153-
<Tab className={classes.tab} label="Mui" />
154-
</a>
155-
</Link>
156-
<Link href={`${router.pathname}?mapper=pf4`}>
157-
<a href={`${router.pathname}?mapper=pf4`} className={clsx(classes.tabLink, { active: activeTab === 1 })}>
158-
<Tab className={classes.tab} label="PF4" />
159-
</a>
160-
</Link>
161-
<Link href={`${router.pathname}?mapper=pf3`}>
162-
<a href={`${router.pathname}?mapper=pf3`} className={clsx(classes.tabLink, { active: activeTab === 2 })}>
163-
<Tab className={classes.tab} label="PF3" />
164-
</a>
165-
</Link>
151+
<Tab
152+
onClick={() => router.push(`${router.pathname}?mapper=mui`)}
153+
className={clsx(classes.tab, { active: activeTab === 0 })}
154+
label={
155+
<Link href={`${router.pathname}?mapper=mui`}>
156+
<a href={`${router.pathname}?mapper=mui`} className={classes.tabLink}>
157+
Mui
158+
</a>
159+
</Link>
160+
}
161+
/>
162+
<Tab
163+
onClick={() => router.push(`${router.pathname}?mapper=pf4`)}
164+
className={clsx(classes.tab, { active: activeTab === 1 })}
165+
label={
166+
<Link href={`${router.pathname}?mapper=pf4`}>
167+
<a href={`${router.pathname}?mapper=pf4`} className={classes.tabLink}>
168+
Pf4
169+
</a>
170+
</Link>
171+
}
172+
/>
173+
<Tab
174+
onClick={() => router.push(`${router.pathname}?mapper=pf3`)}
175+
className={clsx(classes.tab, { active: activeTab === 2 })}
176+
label={
177+
<Link href={`${router.pathname}?mapper=pf3`}>
178+
<a href={`${router.pathname}?mapper=pf3`} className={classes.tabLink}>
179+
Pf3
180+
</a>
181+
</Link>
182+
}
183+
/>
166184
</Tabs>
167185
<div id="code-target"></div>
168186
</Box>

0 commit comments

Comments
 (0)