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 Box from '../../../ui/box';
|
|
|
|
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
Color,
|
|
|
|
AlignItems,
|
|
|
|
JustifyContent,
|
2021-12-01 22:10:51 +01:00
|
|
|
DISPLAY,
|
2023-04-24 12:21:37 +02:00
|
|
|
BLOCK_SIZES,
|
|
|
|
IconColor,
|
|
|
|
TextVariant,
|
2021-12-01 22:10:51 +01:00
|
|
|
} from '../../../../helpers/constants/design-system';
|
2023-04-24 12:21:37 +02:00
|
|
|
import { Icon, IconName, IconSize, Text } from '../../../component-library';
|
|
|
|
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"
|
|
|
|
display={DISPLAY.FLEX}
|
|
|
|
alignItems={AlignItems.center}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
|
|
|
width={BLOCK_SIZES.FULL}
|
|
|
|
padding={[4, 4, 4, 4]}
|
2021-12-01 22:10:51 +01:00
|
|
|
>
|
|
|
|
<Box
|
2023-04-24 12:21:37 +02:00
|
|
|
className="snap-settings-card__inner-wrapper"
|
2021-12-01 22:10:51 +01: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}
|
|
|
|
width={BLOCK_SIZES.FULL}
|
|
|
|
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-04-24 12:21:37 +02:00
|
|
|
<Box paddingLeft={4} paddingRight={4} width={BLOCK_SIZES.FULL}>
|
|
|
|
<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 = {
|
|
|
|
/**
|
|
|
|
* Name of the snap used for the title of the card and fallback letter for the snap icon
|
|
|
|
*/
|
|
|
|
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
|
|
|
/**
|
|
|
|
* onClick function of the "See Details" Button
|
|
|
|
*/
|
|
|
|
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;
|