Skip to content

Commit

Permalink
[Frontend] Create TableHeaderWithTooltip component
Browse files Browse the repository at this point in the history
  • Loading branch information
valtterikantanen committed Nov 27, 2024
1 parent 98eaddc commit 264aaa2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const InfoBox = ({
}
>
{mini ? (
<IconButton data-cy={`${cypress}InfoBoxButton`}>
<IconButton data-cy={`${cypress}InfoBoxButton`} sx={{ padding: 0 }}>
<HelpOutline fontSize="small" />
</IconButton>
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Stack } from '@mui/material'

import { InfoBox } from './InfoBox'

export const TableHeaderWithTooltip = ({ header, tooltipText }: { header: string; tooltipText: string }) => (
<Stack direction="row" gap={1}>
<span style={{ whiteSpace: 'wrap', minWidth: '80px' }}>{header}</span>
<InfoBox content={tooltipText} mini />
</Stack>
)
10 changes: 6 additions & 4 deletions services/frontend/src/components/material/Toggle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ export const Toggle = ({
infoBoxContent?: string
}) => {
return (
<Stack alignItems="center" direction="row">
<Typography color={disabled ? 'text.secondary' : 'text.primary'}>{firstLabel}</Typography>
<Switch checked={value} data-cy={cypress} disabled={disabled} onChange={() => setValue(!value)} />
<Typography color={disabled ? 'text.secondary' : 'text.primary'}>{secondLabel}</Typography>
<Stack alignItems="center" direction="row" gap={1}>
<Stack alignItems="center" direction="row">
<Typography color={disabled ? 'text.secondary' : 'text.primary'}>{firstLabel}</Typography>
<Switch checked={value} data-cy={cypress} disabled={disabled} onChange={() => setValue(!value)} />
<Typography color={disabled ? 'text.secondary' : 'text.primary'}>{secondLabel}</Typography>
</Stack>
{infoBoxContent && <InfoBox content={infoBoxContent} mini />}
</Stack>
)
Expand Down

0 comments on commit 264aaa2

Please sign in to comment.