Skip to content

Commit 0dfc212

Browse files
committed
fix tag chips
- Make the tag chips height fit the content - On the tags page, chips no longer wrap; also add some min width to make mobile editing nicer
1 parent 50ae8ea commit 0dfc212

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ui/src/common/TagChip.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
// @ts-ignore
44
import bestContrast from 'get-best-contrast-color';
55

6-
export const TagChip = ({color, label}: {label: string; color: string}) => {
6+
export const TagChip = ({color, label, style={}}: {label: string; color: string, style?:React.CSSProperties}) => {
77
const textColor = bestContrast(color, ['#fff', '#000']);
88
return (
99
<Chip
@@ -15,8 +15,10 @@ export const TagChip = ({color, label}: {label: string; color: string}) => {
1515
color: textColor,
1616
cursor: 'text',
1717
minHeight: '32px',
18+
height: 'fit-content',
1819
whiteSpace: 'normal',
1920
wordBreak: 'break-word',
21+
... style
2022
}}
2123
label={label}
2224
/>

ui/src/tag/TagPage.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,20 @@ export const TagPage = () => {
8282
}
8383
}}
8484
onSubmit={onClickSubmit}
85+
style={{ minWidth: 128 }}
8586
/>
8687
) : (
8788
tag.key
8889
)}
8990
</TableCell>
90-
<TableCell>
91+
<TableCell style={{minWidth: 128}}>
9192
{isEdited ? (
92-
<SliderPicker onChange={(c) => setEditing([editKey, editKeyNew, c.hex])} color={editColor} />
93+
<SliderPicker
94+
onChange={(c) => setEditing([editKey, editKeyNew, c.hex])}
95+
color={editColor}
96+
/>
9397
) : (
94-
<TagChip label={tag.color} color={tag.color} />
98+
<TagChip label={tag.color} color={tag.color} style={{wordBreak: "normal"}}/>
9599
)}
96100
</TableCell>
97101
<TableCell align="right">{tag.usages}</TableCell>

0 commit comments

Comments
 (0)