2022-09-20 19:00:07 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { useHistory } from 'react-router-dom';
|
|
|
|
|
|
|
|
import Typography from '../../../ui/typography/typography';
|
|
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
|
|
import { SNAPS_VIEW_ROUTE } from '../../../../helpers/constants/routes';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
TypographyVariant,
|
|
|
|
JustifyContent,
|
|
|
|
AlignItems,
|
|
|
|
TextColor,
|
2023-02-24 19:52:11 +01:00
|
|
|
Size,
|
|
|
|
IconColor,
|
2022-09-20 19:00:07 +02:00
|
|
|
} from '../../../../helpers/constants/design-system';
|
|
|
|
import Button from '../../../ui/button';
|
|
|
|
import Box from '../../../ui/box/box';
|
2023-04-19 23:16:49 +02:00
|
|
|
import { Icon, IconName } from '../../../component-library';
|
2022-09-20 19:00:07 +02:00
|
|
|
|
|
|
|
export default function SnapContentFooter({ snapName, snapId }) {
|
|
|
|
const t = useI18nContext();
|
|
|
|
const history = useHistory();
|
|
|
|
|
|
|
|
const handleNameClick = (e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
history.push(`${SNAPS_VIEW_ROUTE}/${encodeURIComponent(snapId)}`);
|
|
|
|
};
|
|
|
|
// TODO: add truncation to the snap name, need to pick a character length at which to cut off
|
|
|
|
return (
|
|
|
|
<Box
|
2023-02-02 21:15:26 +01:00
|
|
|
justifyContent={JustifyContent.center}
|
|
|
|
alignItems={AlignItems.center}
|
2022-09-20 19:00:07 +02:00
|
|
|
paddingTop={4}
|
|
|
|
paddingBottom={4}
|
|
|
|
className="snap-content-footer"
|
|
|
|
>
|
2023-02-24 19:52:11 +01:00
|
|
|
<Icon
|
2023-04-19 23:16:49 +02:00
|
|
|
name={IconName.Warning}
|
2023-02-24 19:52:11 +01:00
|
|
|
size={Size.SM}
|
|
|
|
color={IconColor.iconMuted}
|
|
|
|
paddingRight={1}
|
|
|
|
/>
|
2023-02-02 21:15:26 +01:00
|
|
|
<Typography color={TextColor.textMuted} variant={TypographyVariant.H7}>
|
2022-09-20 19:00:07 +02:00
|
|
|
{t('snapContent', [
|
|
|
|
<Button type="inline" onClick={handleNameClick} key="button">
|
|
|
|
{snapName}
|
|
|
|
</Button>,
|
|
|
|
])}
|
|
|
|
</Typography>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
SnapContentFooter.propTypes = {
|
|
|
|
/**
|
|
|
|
* The name of the snap who's content is displayed
|
|
|
|
*/
|
|
|
|
snapName: PropTypes.string,
|
|
|
|
/**
|
|
|
|
* The id of the snap
|
|
|
|
*/
|
|
|
|
snapId: PropTypes.string,
|
|
|
|
};
|