Makes form components more customizable for easier reuse

This commit is contained in:
Alicia Sykes
2023-07-07 20:58:25 +01:00
parent c9c462f2a1
commit b5e53a33b0
3 changed files with 20 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ export interface RowProps {
children?: ReactNode,
rowList?: RowProps[],
title?: string,
open?: boolean,
}
export const StyledRow = styled.div`
@@ -79,12 +80,12 @@ const copyToClipboard = (text: string) => {
}
export const ExpandableRow = (props: RowProps) => {
const { lbl, val, title, rowList } = props;
const { lbl, val, title, rowList, open } = props;
return (
<Details>
<Details open={open}>
<StyledExpandableRow key={`${lbl}-${val}`}>
<span className="lbl" title={title}>{lbl}</span>
<span className="val" title={val}>{val}</span>
<span className="lbl" title={title?.toString()}>{lbl}</span>
<span className="val" title={val?.toString()}>{val}</span>
</StyledExpandableRow>
{ rowList &&
<SubRowList>