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,35 +46,46 @@ const ExpandableCard = ({
</Avatar>
}
action={
<IconButton
className={clsx(classes.expand, {
[classes.expandOpen]: expanded
})}
onClick={handleExpandClick}
aria-expanded={expanded}
aria-label="show more"
size={smallHeader ? "small" : "medium"}
>
<ExpandMoreIcon />
</IconButton>
<>
{expandable && (
<IconButton
className={clsx(classes.expand, {
[classes.expandOpen]: expanded
})}
onClick={handleExpandClick}
aria-expanded={expanded}
aria-label="show more"
size={smallHeader ? "small" : "medium"}
>
<ExpandMoreIcon />
</IconButton>
)}
</>
}
title={<strong>{title}</strong>}
subheader={subtitle}
/>
{Summary && <CardContent>{Summary}</CardContent>}
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent>{Content}</CardContent>
</Collapse>
{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} />}
/>