Skip to content
Snippets Groups Projects
Verified Commit 1e0dd5ba authored by Andreas Ellewsen's avatar Andreas Ellewsen
Browse files

Enforce double quotes for jsx

parent f8f26b80
No related branches found
No related tags found
1 merge request!112Enforce double quotes for jsx
Pipeline #97070 passed
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"react/jsx-props-no-spreading": "off", "react/jsx-props-no-spreading": "off",
"@typescript-eslint/semi": ["error", "never"], "@typescript-eslint/semi": ["error", "never"],
"react/jsx-uses-react": "off", "react/jsx-uses-react": "off",
"jsx-quotes": "error",
"react/react-in-jsx-scope": "off" "react/react-in-jsx-scope": "off"
} }
} }
...@@ -2,13 +2,12 @@ import React from 'react' ...@@ -2,13 +2,12 @@ import React from 'react'
import { render, waitFor, screen } from '@testing-library/react' import { render, waitFor, screen } from '@testing-library/react'
import Link from './index' import Link from './index'
describe('Tests for Link component', () => { describe('Tests for Link component', () => {
test('External link prefixes route link with //', async () => { test('External link prefixes route link with //', async () => {
render(<Link external to='example.org' />) render(<Link external to="example.org" />)
await waitFor(() => screen.getByRole('link')) await waitFor(() => screen.getByRole('link'))
expect(screen.getByRole('link')).toHaveAttribute('href', '//example.org') expect(screen.getByRole('link')).toHaveAttribute('href', '//example.org')
}) })
}) })
\ No newline at end of file
...@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next' ...@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { useHistory } from 'react-router-dom' import { useHistory } from 'react-router-dom'
interface SponsorGuestButtonsProps { interface SponsorGuestButtonsProps {
yourGuestsActive?: boolean, yourGuestsActive?: boolean
registerNewGuestActive?: boolean registerNewGuestActive?: boolean
} }
...@@ -24,41 +24,70 @@ export default function SponsorGuestButtons(props: SponsorGuestButtonsProps) { ...@@ -24,41 +24,70 @@ export default function SponsorGuestButtons(props: SponsorGuestButtonsProps) {
} }
return ( return (
<Box sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-evenly', marginBottom: '2rem' }}> <Box
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}> sx={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-evenly',
marginBottom: '2rem',
}}
>
<Box
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}
>
<IconButton onClick={goToOverview}> <IconButton onClick={goToOverview}>
<PersonIcon <PersonIcon
fontSize='large' fontSize="large"
sx={{ sx={{
borderRadius: '2rem', borderRadius: '2rem',
borderStyle: 'solid', borderStyle: 'solid',
borderColor: (theme: Theme) => yourGuestsActive ? theme.palette.primary.main : theme.greg.deactivatedColor, borderColor: (theme: Theme) =>
yourGuestsActive
? theme.palette.primary.main
: theme.greg.deactivatedColor,
fill: 'white', fill: 'white',
backgroundColor: (theme: Theme) => yourGuestsActive ? theme.palette.primary.main : theme.greg.deactivatedColor, backgroundColor: (theme: Theme) =>
}} /> yourGuestsActive
? theme.palette.primary.main
: theme.greg.deactivatedColor,
}}
/>
</IconButton> </IconButton>
<Box sx={{ <Box
typography: 'caption', sx={{
}}> typography: 'caption',
}}
>
{t('yourGuests')} {t('yourGuests')}
</Box> </Box>
</Box> </Box>
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}> <Box
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}
>
<IconButton onClick={goToRegister}> <IconButton onClick={goToRegister}>
<PersonAddIcon <PersonAddIcon
fontSize='large' fontSize="large"
sx={{ sx={{
borderRadius: '2rem', borderRadius: '2rem',
borderStyle: 'solid', borderStyle: 'solid',
borderColor: (theme: Theme) => registerNewGuestActive ? theme.palette.primary.main : theme.greg.deactivatedColor, borderColor: (theme: Theme) =>
registerNewGuestActive
? theme.palette.primary.main
: theme.greg.deactivatedColor,
fill: 'white', fill: 'white',
backgroundColor: (theme: Theme) => registerNewGuestActive ? theme.palette.primary.main : theme.greg.deactivatedColor, backgroundColor: (theme: Theme) =>
}} /> registerNewGuestActive
? theme.palette.primary.main
: theme.greg.deactivatedColor,
}}
/>
</IconButton> </IconButton>
<Box sx={{ <Box
typography: 'caption', sx={{
}}> typography: 'caption',
}}
>
{t('registerNewGuest')} {t('registerNewGuest')}
</Box> </Box>
</Box> </Box>
......
...@@ -33,13 +33,13 @@ const RoleLine = ({ guest }: RoleLineProps) => { ...@@ -33,13 +33,13 @@ const RoleLine = ({ guest }: RoleLineProps) => {
key={guest.id} key={guest.id}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
> >
<TableCell align='left'> <TableCell align="left">
{i18n.language === 'en' ? guest.role_en : guest.role_nb} {i18n.language === 'en' ? guest.role_en : guest.role_nb}
</TableCell> </TableCell>
<TableCell component='th' scope='row'> <TableCell component="th" scope="row">
{guest.period} {guest.period}
</TableCell> </TableCell>
<TableCell align='left'> <TableCell align="left">
{i18n.language === 'en' ? guest.ou_en : guest.ou_nb} {i18n.language === 'en' ? guest.ou_en : guest.ou_nb}
</TableCell> </TableCell>
</TableRow> </TableRow>
...@@ -68,7 +68,7 @@ export default function GuestInfo({ guests }: GuestInfoProps) { ...@@ -68,7 +68,7 @@ export default function GuestInfo({ guests }: GuestInfoProps) {
}} }}
> >
<Box> <Box>
<IconButton component={Link} to='/sponsor'> <IconButton component={Link} to="/sponsor">
<ArrowBackIcon /> <ArrowBackIcon />
</IconButton> </IconButton>
</Box> </Box>
...@@ -80,7 +80,7 @@ export default function GuestInfo({ guests }: GuestInfoProps) { ...@@ -80,7 +80,7 @@ export default function GuestInfo({ guests }: GuestInfoProps) {
}} }}
> >
<PersonOutlineRoundedIcon <PersonOutlineRoundedIcon
fontSize='large' fontSize="large"
sx={{ sx={{
borderRadius: '2rem', borderRadius: '2rem',
borderStyle: 'solid', borderStyle: 'solid',
...@@ -100,41 +100,41 @@ export default function GuestInfo({ guests }: GuestInfoProps) { ...@@ -100,41 +100,41 @@ export default function GuestInfo({ guests }: GuestInfoProps) {
</Box> </Box>
<h4>{t('sponsor.contactInfo')}</h4> <h4>{t('sponsor.contactInfo')}</h4>
<TableContainer component={Paper}> <TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }} aria-label='simple table'> <Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead sx={{ backgroundColor: 'primary.light' }}> <TableHead sx={{ backgroundColor: 'primary.light' }}>
<TableRow> <TableRow>
<TableCell align='left'>{t('sponsor.contactInfo')}</TableCell> <TableCell align="left">{t('sponsor.contactInfo')}</TableCell>
<TableCell /> <TableCell />
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
<TableRow> <TableRow>
<TableCell align='left'>{t('input.fullName')}</TableCell> <TableCell align="left">{t('input.fullName')}</TableCell>
<TableCell align='left'>{guestInfo.name}</TableCell> <TableCell align="left">{guestInfo.name}</TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell align='left'>{t('input.email')}</TableCell> <TableCell align="left">{t('input.email')}</TableCell>
<TableCell align='left'>{guestInfo.email}</TableCell> <TableCell align="left">{guestInfo.email}</TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell align='left'>{t('input.nationalIdNumber')}</TableCell> <TableCell align="left">{t('input.nationalIdNumber')}</TableCell>
<TableCell align='left'>{guestInfo.fnr}</TableCell> <TableCell align="left">{guestInfo.fnr}</TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell align='left'>{t('input.mobilePhone')}</TableCell> <TableCell align="left">{t('input.mobilePhone')}</TableCell>
<TableCell align='left'>{guestInfo.mobile}</TableCell> <TableCell align="left">{guestInfo.mobile}</TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>
<h4>{t('sponsor.roleInfo')}</h4> <h4>{t('sponsor.roleInfo')}</h4>
<TableContainer component={Paper}> <TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }} aria-label='simple table'> <Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead sx={{ backgroundColor: 'primary.light' }}> <TableHead sx={{ backgroundColor: 'primary.light' }}>
<TableRow> <TableRow>
<TableCell align='left'>{t('common:role')}</TableCell> <TableCell align="left">{t('common:role')}</TableCell>
<TableCell align='left'>{t('common:period')}</TableCell> <TableCell align="left">{t('common:period')}</TableCell>
<TableCell align='left'>{t('common:ou')}</TableCell> <TableCell align="left">{t('common:ou')}</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment