Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid DOM nesting #1339

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions operator_ui/src/components/JobRuns/RegionalNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ const RegionalNav = ({ classes, jobSpecId, jobRunId, jobRun, url }) => {
<Typography variant="subtitle2" color="secondary" gutterBottom>
Job Run Detail
</Typography>
<Link to={`/jobs/${jobSpecId}`}>
<Typography variant="subtitle1" color="primary">
{jobSpecId}
</Typography>
<Link to={`/jobs/${jobSpecId}`} variant="subtitle1" color="primary">
{jobSpecId}
</Link>
</Grid>
<Grid item xs={12}>
Expand Down
31 changes: 0 additions & 31 deletions operator_ui/src/components/Link.js

This file was deleted.

50 changes: 50 additions & 0 deletions operator_ui/src/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react'
import { Link as ReactStaticLink } from 'react-router-dom'
import {
createStyles,
Theme,
withStyles,
WithStyles
} from '@material-ui/core/styles'
import Typography from '@material-ui/core/Typography'
import { grey } from '@material-ui/core/colors'
import { ThemeStyle } from '@material-ui/core/styles/createTypography'
import { PropTypes } from '@material-ui/core'
import classNames from 'classnames'

type Variant = ThemeStyle | 'srOnly'
type Color = PropTypes.Color | 'textPrimary' | 'textSecondary' | 'error'

const styles = (_theme: Theme) =>
createStyles({
link: {
color: grey[900],
textDecoration: 'none'
},
linkContent: {
display: 'inline-block'
}
})

interface IProps extends WithStyles<typeof styles> {
children: React.ReactNode
to: string
variant?: Variant
color?: Color
className?: string
}

const Link = ({ children, classes, className, to, variant, color }: IProps) => {
const v = variant || 'body1'
const c = color || 'inherit'

return (
<ReactStaticLink to={to} className={classNames(classes.link, className)}>
<Typography variant={v} color={c} className={classes.linkContent}>
{children}
</Typography>
</ReactStaticLink>
)
}

export default withStyles(styles)(Link)