1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-04 23:14:56 +01:00
metamask-extension/ui/pages/onboarding-flow/privacy-settings/setting.js
Thomas Huang 18e4af7690
Unit test proptype (#14868)
* Add missing props to advanced tab component test.

* Add icon size prop to site icon test

* Add hardwareWalletRequiresConnection prop to signature request test as a boolean

* Add setShowDetectedTokens prop to detect token test

* Set Setting description prop to be either object or string.
2022-06-06 19:30:07 -07:00

34 lines
1.1 KiB
JavaScript

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 {
JUSTIFY_CONTENT,
TYPOGRAPHY,
FONT_WEIGHT,
} from '../../../helpers/constants/design-system';
export const Setting = ({ value, setValue, title, description }) => {
return (
<Box justifyContent={JUSTIFY_CONTENT.CENTER} margin={3}>
<div className="privacy-settings__setting">
<Typography variant={TYPOGRAPHY.H5} fontWeight={FONT_WEIGHT.BOLD}>
{title}
</Typography>
<Typography variant={TYPOGRAPHY.H6}>{description}</Typography>
</div>
<div className="privacy-settings__setting__toggle">
<ToggleButton value={value} onToggle={(val) => setValue(!val)} />
</div>
</Box>
);
};
Setting.propTypes = {
value: PropTypes.bool,
setValue: PropTypes.func,
title: PropTypes.string,
description: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
};