Skip to content

Commit

Permalink
web: Use status icon in the ExpandableField label
Browse files Browse the repository at this point in the history
To somehow keeps the representation that the field is expanded or not.
This should be considered a workaround and must be changed to something
more expressive, meaningful, and usable: a "Basic View | Advanced View"
control.
  • Loading branch information
dgdavid committed Apr 16, 2024
1 parent f145bd2 commit 196a622
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/src/components/core/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ const SwitchField = ({ isChecked = false, highlightContent = false, ...props })
/**
* @param {FieldProps & {isExpanded: boolean}} props
*/
const ExpandableField = ({ isExpanded, ...props }) => {
const ExpandableField = ({ label, isExpanded, ...props }) => {
const iconName = isExpanded ? "collapse_all" : "expand_all";
const className = isExpanded ? "expanded" : "collapsed";
const iconizedLabel = <>{label} <Icon name={iconName} size="xs" /></>;

return <Field {...props} className={className} />;
return <Field {...props} label={iconizedLabel} className={className} />;
};

export default Field;
Expand Down

0 comments on commit 196a622

Please sign in to comment.