Skip to content

Commit

Permalink
fix(Hyperlinks): lint and rule of React hook
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Jul 21, 2024
1 parent 0d044f5 commit ab0688a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions components/Hyperlinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const useStyles = makeStyles(theme => ({
paddingRight: 'var(--gutter)',
'& article': {
maxWidth: '90%',
}
},
},
},
url: {
Expand Down Expand Up @@ -196,24 +196,19 @@ function PollingHyperlink({ pollingType, pollingId }) {
* @param {string?} props.rel - rel prop for the hyperlink (other than noopener and noreferrer)
*/
function Hyperlinks({ hyperlinks, pollingType, pollingId, rel }) {
const classes = useStyles();
if (!((pollingId && pollingType) || (!pollingId && !pollingType))) {
throw new Error('pollingType and pollingId must be specified together');
}

if (hyperlinks && hyperlinks.length === 0) return null;

const classes = useStyles();
var className = `${classes.root}`;
let className = `${classes.root}`;
if (hyperlinks.length > 1) {
className += ` ${classes.multilink}`;
}
return (
<Box
className={className}
component="section"
mt={2}
mb={1}
>
<Box className={className} component="section" mt={2} mb={1}>
{(hyperlinks || []).map((hyperlink, idx) => (
<Hyperlink key={idx} hyperlink={hyperlink} rel={rel} />
))}
Expand Down

0 comments on commit ab0688a

Please sign in to comment.