Skip to content

Commit 61f1f9c

Browse files
committed
feat(ui-pill): migrate to new theming system
1 parent b8c1e81 commit 61f1f9c

File tree

3 files changed

+37
-125
lines changed

3 files changed

+37
-125
lines changed

docs/guides/upgrade-guide.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,37 @@ The new icons automatically sync with theme changes, support all InstUI color to
7676
- `alert` color has been removed. Please use `primary` instead.
7777
- Some prop values have been deprecated, see [Text](/Text) for more details.
7878

79+
### Pill
80+
81+
#### Deprecated color prop values
82+
83+
The following `color` prop values have been **removed**:
84+
85+
- `'danger'` - use `'error'` instead
86+
- `'alert'` - use `'info'` instead
87+
88+
#### Theme variable changes
89+
90+
- theme variable `fontFamily` has been added
91+
- theme variable `padding` has been renamed to `paddingHorizontal` (now only controls horizontal padding)
92+
- theme variable `background` has been renamed to `backgroundColor`
93+
- theme variable `primaryColor` has been split into:
94+
- `baseTextColor` (for text color)
95+
- `baseBorderColor` (for border color)
96+
- theme variable `successColor` has been split into:
97+
- `successTextColor` (for text color)
98+
- `successBorderColor` (for border color)
99+
- theme variable `infoColor` has been split into:
100+
- `infoTextColor` (for text color)
101+
- `infoBorderColor` (for border color)
102+
- theme variable `warningColor` has been split into:
103+
- `warningTextColor` (for text color)
104+
- `warningBorderColor` (for border color)
105+
- theme variable `dangerColor` has been removed, replaced with:
106+
- `errorTextColor` (for text color)
107+
- `errorBorderColor` (for border color)
108+
- theme variable `alertColor` has been removed (use `info*` variables instead)
109+
79110
## API Changes
80111

81112
### Focus rings

packages/ui-pill/src/Pill/README.md

Lines changed: 3 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -11,85 +11,6 @@ you can use the `statusLabel` prop to add a label to the left of the main text.
1111
---
1212
type: example
1313
---
14-
<div>
15-
16-
<InstUISettingsProvider theme={canvas}>
17-
<div>
18-
<Pill
19-
margin="x-small"
20-
>
21-
Excused
22-
</Pill>
23-
<Pill
24-
statusLabel="Status"
25-
color="info"
26-
margin="x-small"
27-
>
28-
Draft
29-
</Pill>
30-
<Pill
31-
statusLabel="Status"
32-
renderIcon={<IconCheckLine />}
33-
color="success"
34-
margin="x-small"
35-
>
36-
Checked In
37-
</Pill>
38-
<Pill
39-
renderIcon={<IconClockLine />}
40-
color="warning"
41-
margin="x-small"
42-
>
43-
Late
44-
</Pill>
45-
<Pill
46-
renderIcon={<IconMessageLine />}
47-
color="error"
48-
margin="x-small"
49-
>
50-
Notification
51-
</Pill>
52-
</div>
53-
</InstUISettingsProvider>
54-
<InstUISettingsProvider theme={canvasHighContrast}>
55-
<div>
56-
<Pill
57-
margin="x-small"
58-
>
59-
Excused
60-
</Pill>
61-
<Pill
62-
statusLabel="Status"
63-
color="info"
64-
margin="x-small"
65-
>
66-
Draft
67-
</Pill>
68-
<Pill
69-
statusLabel="Status"
70-
renderIcon={<IconCheckLine />}
71-
color="success"
72-
margin="x-small"
73-
>
74-
Checked In
75-
</Pill>
76-
<Pill
77-
renderIcon={<IconClockLine />}
78-
color="warning"
79-
margin="x-small"
80-
>
81-
Late
82-
</Pill>
83-
<Pill
84-
renderIcon={<IconMessageLine />}
85-
color="error"
86-
margin="x-small"
87-
>
88-
Notification
89-
</Pill>
90-
</div>
91-
</InstUISettingsProvider>
92-
<InstUISettingsProvider theme={rebrandLight}>
9314
<div>
9415
<Pill
9516
margin="x-small"
@@ -105,67 +26,27 @@ type: example
10526
</Pill>
10627
<Pill
10728
statusLabel="Status"
108-
renderIcon={<IconCheckLine />}
29+
renderIcon={<CheckInstUIIcon size="sm" />}
10930
color="success"
11031
margin="x-small"
11132
>
11233
Checked In
11334
</Pill>
11435
<Pill
115-
renderIcon={<IconClockLine />}
36+
renderIcon={<Clock4InstUIIcon size="sm" />}
11637
color="warning"
11738
margin="x-small"
11839
>
11940
Late
12041
</Pill>
12142
<Pill
122-
renderIcon={<IconMessageLine />}
43+
renderIcon={<MailInstUIIcon size="sm" />}
12344
color="error"
12445
margin="x-small"
12546
>
12647
Notification
12748
</Pill>
12849
</div>
129-
</InstUISettingsProvider>
130-
<InstUISettingsProvider theme={rebrandDark}>
131-
<div>
132-
<Pill
133-
margin="x-small"
134-
>
135-
Excused
136-
</Pill>
137-
<Pill
138-
statusLabel="Status"
139-
color="info"
140-
margin="x-small"
141-
>
142-
Draft
143-
</Pill>
144-
<Pill
145-
statusLabel="Status"
146-
renderIcon={<IconCheckLine />}
147-
color="success"
148-
margin="x-small"
149-
>
150-
Checked In
151-
</Pill>
152-
<Pill
153-
renderIcon={<IconClockLine />}
154-
color="warning"
155-
margin="x-small"
156-
>
157-
Late
158-
</Pill>
159-
<Pill
160-
renderIcon={<IconMessageLine />}
161-
color="error"
162-
margin="x-small"
163-
>
164-
Notification
165-
</Pill>
166-
</div>
167-
</InstUISettingsProvider>
168-
</div>
16950
```
17051

17152
The component has a `max-width`, set by its theme. Any overflowing text will be handled via ellipses.

packages/ui-pill/src/Pill/styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ const generateStyle = (
6868
label: 'pill',
6969
display: 'flex',
7070
alignItems: 'center',
71-
justifyContent: 'center',
7271
boxSizing: 'border-box',
7372
padding: `0 ${componentTheme.paddingHorizontal}`,
7473
background: componentTheme.backgroundColor,
7574
borderWidth: componentTheme.borderWidth,
7675
borderStyle: componentTheme.borderStyle,
7776
borderRadius: componentTheme.borderRadius,
78-
/* line-height does not account for top/bottom border width */
79-
lineHeight: `calc(${componentTheme.height} - (${componentTheme.borderWidth} * 2))`,
77+
fontFamily: componentTheme.fontFamily,
78+
height: componentTheme.height,
79+
lineHeight: componentTheme.lineHeight,
8080
...pillColorVariants[color!]
8181
},
8282
status: {

0 commit comments

Comments
 (0)