Skip to content

Commit

Permalink
feat: style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikmv committed Nov 27, 2024
1 parent 684210b commit cfb870d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ const styles = {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
whiteSpace: 'normal',
height: '100%',
},
buttonContainer: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
previousValue: {
Expand All @@ -46,10 +44,9 @@ const styles = {
currentValue: {
color: colors.grey900,
wordBreak: 'break-word',
maxWidth: '82%',
},
updateArrow: {
display: 'inline-flex',
alignItems: 'center',
margin: spacers.dp4,
},
viewButton: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Updated = ({ previousValue, currentValue, classes }: ChangelogValueCellPro

const Created = ({ currentValue, classes }: ChangelogValueCellProps) => (
<div className={classes.container}>
<span className={classes.currentValue}>{currentValue}</span>
<span>{currentValue}</span>
</div>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { IconArrowRight16, IconChevronUp16, IconChevronDown16 } from '@dhis2/ui'
import { CHANGE_TYPES } from '../../../../Changelog/Changelog.constants';
import type { ChangelogValueCellProps } from './ChangelogValueCellComponents.types';

const ValueDisplay = ({ value, showMore, className }) => (
<span className={className}>{showMore ? value : value?.slice(0, 1)}</span>
const ValueDisplay = ({ value, showMore }) => (
<span>{showMore ? value : value?.[0]}</span>
);

const ViewMoreButton = ({ showMore, onClick, classes }) => (
Expand Down Expand Up @@ -52,37 +52,45 @@ const Created = ({ currentValue, classes }: ChangelogValueCellProps) => {
const [showMore, setShowMore] = useState(false);

return (
<div className={classes.container}>
<ValueDisplay
value={currentValue}
showMore={showMore}
className={classes.currentValue}
/>
<ViewMoreButton
showMore={showMore}
onClick={() => setShowMore(!showMore)}
classes={classes}
/>
</div>
<>
<div className={classes.container}>
<ValueDisplay
value={currentValue}
showMore={showMore}
/>
</div>
<div className={classes.buttonContainer}>
<ViewMoreButton
showMore={showMore}
onClick={() => setShowMore(!showMore)}
classes={classes}
/>
</div>
</>
);
};

const Deleted = ({ previousValue, classes }: ChangelogValueCellProps) => {
const [showMore, setShowMore] = useState(false);

return (
<div className={classes.container}>
<ValueDisplay
value={previousValue}
showMore={showMore}
className={classes.previousValue}
/>
<ViewMoreButton
showMore={showMore}
onClick={() => setShowMore(!showMore)}
classes={classes}
/>
</div>
<>
<div className={classes.container}>
<ValueDisplay
value={previousValue}
showMore={showMore}
className={classes.previousValue}
/>
</div>
<div className={classes.buttonContainer}>
<ViewMoreButton
showMore={showMore}
onClick={() => setShowMore(!showMore)}
classes={classes}
/>
</div>
</>

);
};

Expand Down

0 comments on commit cfb870d

Please sign in to comment.