KeyOverwriteCard improvements

master
Tudor Stanciu 2021-06-25 14:44:35 +03:00
parent 4dc2b3e25e
commit 22d96b69f1
2 changed files with 27 additions and 14 deletions

View File

@ -21,6 +21,7 @@ const ExpandableCard = ({
title,
subtitle,
smallHeader,
expandable,
Summary,
Content
}) => {
@ -45,6 +46,8 @@ const ExpandableCard = ({
</Avatar>
}
action={
<>
{expandable && (
<IconButton
className={clsx(classes.expand, {
[classes.expandOpen]: expanded
@ -56,24 +59,33 @@ const ExpandableCard = ({
>
<ExpandMoreIcon />
</IconButton>
)}
</>
}
title={<strong>{title}</strong>}
subheader={subtitle}
/>
{Summary && <CardContent>{Summary}</CardContent>}
{expandable && (
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent>{Content}</CardContent>
</Collapse>
)}
</Card>
);
};
ExpandableCard.defaultProps = {
expandable: true
};
ExpandableCard.propTypes = {
Icon: PropTypes.node.isRequired,
iconVariant: PropTypes.oneOf(["circle", "circular", "rounded", "square"]),
title: PropTypes.string.isRequired,
subtitle: PropTypes.string,
smallHeader: PropTypes.bool,
expandable: PropTypes.bool,
Summary: PropTypes.node,
Content: PropTypes.node.isRequired
};

View File

@ -14,6 +14,7 @@ const KeyOverwriteCard = ({ data }) => {
Icon={<FindReplaceIcon />}
title={t("Forward.Options.KeyOverwrite.Label")}
subtitle={t("Forward.Options.KeyOverwrite.Tooltip")}
expandable={data.advancedSettings}
Summary={<KeyOverwriteSummary data={data} />}
Content={<AdvancedSettingsComponent data={data.advancedSettings} />}
/>