2021-10-08 21:50:36 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Box from '../../../components/ui/box';
|
|
|
|
import Typography from '../../../components/ui/typography';
|
|
|
|
import ToggleButton from '../../../components/ui/toggle-button';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
JustifyContent,
|
|
|
|
TypographyVariant,
|
2021-10-08 21:50:36 +02:00
|
|
|
FONT_WEIGHT,
|
|
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
|
2022-12-08 17:42:23 +01:00
|
|
|
export const Setting = ({
|
|
|
|
value,
|
|
|
|
setValue,
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
showToggle = true,
|
|
|
|
}) => {
|
2021-10-08 21:50:36 +02:00
|
|
|
return (
|
2023-02-02 21:15:26 +01:00
|
|
|
<Box justifyContent={JustifyContent.center} margin={3}>
|
2021-10-08 21:50:36 +02:00
|
|
|
<div className="privacy-settings__setting">
|
2023-02-02 21:15:26 +01:00
|
|
|
<Typography
|
|
|
|
variant={TypographyVariant.H5}
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
>
|
2021-10-08 21:50:36 +02:00
|
|
|
{title}
|
|
|
|
</Typography>
|
2023-02-02 21:15:26 +01:00
|
|
|
<Typography variant={TypographyVariant.H6}>{description}</Typography>
|
2021-10-08 21:50:36 +02:00
|
|
|
</div>
|
2022-12-08 17:42:23 +01:00
|
|
|
{showToggle ? (
|
|
|
|
<div className="privacy-settings__setting__toggle">
|
|
|
|
<ToggleButton value={value} onToggle={(val) => setValue(!val)} />
|
|
|
|
</div>
|
|
|
|
) : null}
|
2021-10-08 21:50:36 +02:00
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
Setting.propTypes = {
|
|
|
|
value: PropTypes.bool,
|
|
|
|
setValue: PropTypes.func,
|
|
|
|
title: PropTypes.string,
|
2022-06-07 04:30:07 +02:00
|
|
|
description: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
2022-12-08 17:42:23 +01:00
|
|
|
showToggle: PropTypes.bool,
|
2021-10-08 21:50:36 +02:00
|
|
|
};
|