2022-01-28 22:40:13 +01:00
|
|
|
import React from 'react';
|
2021-12-01 22:10:51 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
Color,
|
|
|
|
AlignItems,
|
|
|
|
JustifyContent,
|
2023-08-14 22:25:41 +02:00
|
|
|
Display,
|
|
|
|
BlockSize,
|
2023-04-24 12:21:37 +02:00
|
|
|
IconColor,
|
|
|
|
TextVariant,
|
2021-12-01 22:10:51 +01:00
|
|
|
} from '../../../../helpers/constants/design-system';
|
2023-08-14 22:25:41 +02:00
|
|
|
import {
|
|
|
|
Icon,
|
|
|
|
IconName,
|
|
|
|
IconSize,
|
|
|
|
Text,
|
|
|
|
Box,
|
|
|
|
} from '../../../component-library';
|
2023-04-24 12:21:37 +02:00
|
|
|
import SnapAvatar from '../snap-avatar';
|
2021-12-01 22:10:51 +01:00
|
|
|
|
2023-04-24 12:21:37 +02:00
|
|
|
const SnapSettingsCard = ({ name, packageName, onClick, snapId }) => {
|
2021-12-01 22:10:51 +01:00
|
|
|
return (
|
2023-04-24 12:21:37 +02:00
|
|
|
<Box
|
|
|
|
className="snap-settings-card"
|
2023-08-14 22:25:41 +02:00
|
|
|
display={Display.Flex}
|
2023-04-24 12:21:37 +02:00
|
|
|
alignItems={AlignItems.center}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2023-08-14 22:25:41 +02:00
|
|
|
width={BlockSize.Full}
|
|
|
|
padding={4}
|
2021-12-01 22:10:51 +01:00
|
|
|
>
|
|
|
|
<Box
|
2023-04-24 12:21:37 +02:00
|
|
|
className="snap-settings-card__inner-wrapper"
|
2023-08-14 22:25:41 +02:00
|
|
|
display={Display.Flex}
|
2023-02-02 21:15:26 +01:00
|
|
|
alignItems={AlignItems.center}
|
2023-04-24 12:21:37 +02:00
|
|
|
justifyContent={JustifyContent.flexStart}
|
2023-08-14 22:25:41 +02:00
|
|
|
width={BlockSize.Full}
|
2023-04-24 12:21:37 +02:00
|
|
|
onClick={onClick}
|
2021-12-01 22:10:51 +01:00
|
|
|
>
|
2023-04-24 12:21:37 +02:00
|
|
|
<Box>
|
|
|
|
<SnapAvatar snapId={snapId} />
|
2021-12-01 22:10:51 +01:00
|
|
|
</Box>
|
2023-08-14 22:25:41 +02:00
|
|
|
<Box paddingLeft={4} paddingRight={4} width={BlockSize.Full}>
|
2023-04-24 12:21:37 +02:00
|
|
|
<Text
|
|
|
|
className="snap-settings-card__title"
|
|
|
|
color={Color.textDefault}
|
|
|
|
variant={TextVariant.bodyMd}
|
2021-12-01 22:10:51 +01:00
|
|
|
>
|
2023-04-24 12:21:37 +02:00
|
|
|
{name}
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
className="snap-settings-card__url"
|
|
|
|
color={Color.textAlternative}
|
|
|
|
variant={TextVariant.bodySm}
|
|
|
|
>
|
|
|
|
{packageName}
|
|
|
|
</Text>
|
2021-12-01 22:10:51 +01:00
|
|
|
</Box>
|
|
|
|
</Box>
|
2023-04-24 12:21:37 +02:00
|
|
|
<Box className="snap-settings-card__caret" onClick={onClick}>
|
|
|
|
<Icon
|
|
|
|
name={IconName.ArrowRight}
|
|
|
|
size={IconSize.Md}
|
|
|
|
color={IconColor.iconMuted}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
2021-12-01 22:10:51 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
SnapSettingsCard.propTypes = {
|
|
|
|
/**
|
2023-08-14 22:25:41 +02:00
|
|
|
* Name of the snap
|
2021-12-01 22:10:51 +01:00
|
|
|
*/
|
|
|
|
name: PropTypes.string,
|
|
|
|
/**
|
2023-04-24 12:21:37 +02:00
|
|
|
* Name of a snap package
|
2021-12-01 22:10:51 +01:00
|
|
|
*/
|
2023-04-24 12:21:37 +02:00
|
|
|
packageName: PropTypes.string,
|
2021-12-01 22:10:51 +01:00
|
|
|
/**
|
2023-08-14 22:25:41 +02:00
|
|
|
* onClick event handler
|
2021-12-01 22:10:51 +01:00
|
|
|
*/
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
/**
|
2023-04-24 12:21:37 +02:00
|
|
|
* ID of a snap.
|
2021-12-01 22:10:51 +01:00
|
|
|
*/
|
2023-04-24 12:21:37 +02:00
|
|
|
snapId: PropTypes.string.isRequired,
|
2021-12-01 22:10:51 +01:00
|
|
|
};
|
|
|
|
export default SnapSettingsCard;
|