1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 14:15:06 +01:00
metamask-extension/ui/pages/onboarding-flow/privacy-settings/setting.js
Harsh Shukla b8475f85d4
Part of #17670 for: privacy-settings.js (#20288)
* Update privacy-settings.js

* Update ui/pages/onboarding-flow/privacy-settings/privacy-settings.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/pages/onboarding-flow/privacy-settings/privacy-settings.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/pages/onboarding-flow/privacy-settings/privacy-settings.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/pages/onboarding-flow/privacy-settings/privacy-settings.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/pages/onboarding-flow/privacy-settings/privacy-settings.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update privacy-settings.js

* Update index.scss

* Update to html nesting and semantic fix

* lint fix

---------

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2023-08-15 14:05:04 -07:00

61 lines
1.5 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { Box, Text } from '../../../components/component-library';
import ToggleButton from '../../../components/ui/toggle-button';
import {
JustifyContent,
TextVariant,
AlignItems,
Display,
FontWeight,
} from '../../../helpers/constants/design-system';
import { useI18nContext } from '../../../hooks/useI18nContext';
export const Setting = ({
value,
setValue,
title,
description,
showToggle = true,
}) => {
const t = useI18nContext();
return (
<Box
display={Display.Flex}
justifyContent={JustifyContent.spaceBetween}
alignItems={AlignItems.center}
marginTop={3}
marginBottom={3}
className="privacy-settings__setting__wrapper"
>
<div className="privacy-settings__setting">
<Text variant={TextVariant.bodyLgMedium} fontWeight={FontWeight.Bold}>
{title}
</Text>
<Text variant={TextVariant.bodyMd} as="div">
{description}
</Text>
</div>
{showToggle ? (
<div className="privacy-settings__setting__toggle">
<ToggleButton
value={value}
onToggle={(val) => setValue(!val)}
offLabel={t('off')}
onLabel={t('on')}
/>
</div>
) : null}
</Box>
);
};
Setting.propTypes = {
value: PropTypes.bool,
setValue: PropTypes.func,
title: PropTypes.string,
description: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
showToggle: PropTypes.bool,
};