Skip to content

Commit 23cdd00

Browse files
Button tones (#1264)
* Adopt the family grey button and the danger tone Phase 2 of the focus-and-colour plan. The `zoom` variant goes: it and data-microbit-org's `solid` were the same grey filled button, now @microbit/ui's `neutral`, and it keeps this app's hover/press stops. Four call sites, the zoom and undo/redo pills. The destructive pair becomes the `danger` tone of the shared `outline` and `solid` shapes — the reset button and the confirm dialog. Colour is identical: the deleted `warning`/`warningSolid` variants read the same danger tokens the tone now aliases. `sidebar` stays. It is the only white-on-dark icon button in the family with a white-pill hover, so there is no second consumer to share it with. * Upgrade to @microbit/ui@0.1.0-alpha.29
1 parent 8015728 commit 23cdd00

7 files changed

Lines changed: 18 additions & 28 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@codemirror/view": "^6.26.3",
2222
"@microbit/microbit-connection": "^1.0.0",
2323
"@microbit/microbit-fs": "^0.10.0",
24-
"@microbit/ui": "0.1.0-alpha.28",
24+
"@microbit/ui": "0.1.0-alpha.29",
2525
"@microbit/ui-patterns": "0.1.0-alpha.3",
2626
"@sanity/block-content-to-react": "^3.0.0",
2727
"@sanity/image-url": "^1.0.1",

src/common/ConfirmDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const ConfirmDialog = ({
4141
<Button autoFocus onPress={() => callback(false)}>
4242
<FormattedMessage id="cancel-action" />
4343
</Button>
44-
<Button variant="warningSolid" onPress={() => callback(true)}>
44+
<Button variant="solid" tone="danger" onPress={() => callback(true)}>
4545
{actionLabel}
4646
</Button>
4747
</ModalFooter>

src/deployment/default/panda-preset.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ export const appPreset = definePreset({
9696
text: {
9797
defaultVariants: { size: "md" },
9898
},
99-
// python-editor's default button variant is `outline` (the family
100-
// base recipe defaults to `secondary`): brand text over a
101-
// transparent, brand-bordered button. Non-brand outline cases use
102-
// `warning`.
99+
// The app's own button vocabulary; everything else is the base
100+
// recipe's, with destructive actions on `tone="danger"`.
103101
button: {
104102
variants: {
105103
variant: {
@@ -111,19 +109,6 @@ export const appPreset = definePreset({
111109
_hover: { bg: "white", color: "gray.700" },
112110
_active: { bg: "white", color: "gray.800" },
113111
},
114-
// The editor zoom / undo-redo pill pairs: gray fill with
115-
// darker hover/active.
116-
zoom: {
117-
color: "gray.800",
118-
bg: "gray.100",
119-
// Re-pointed for the neutral ink grades (@microbit/ui
120-
// docs/gray-ramp.md): the branded build's hover/press were
121-
// #c9c9c9/#b0b0b0 — hover's nearest stop is 300, and press
122-
// takes the press-weight 350 (#b4b4b4, ≈ the old value; the
123-
// old 400/500 names sit much darker post-re-grade).
124-
_hover: { bg: "gray.300" },
125-
_active: { bg: "gray.350" },
126-
},
127112
},
128113
},
129114
},

src/editor/UndoRedoControls.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const UndoRedoControls = ({ css: cssProp }: UndoRedoControlsProps) => {
3232
>
3333
<IconButton
3434
isRound
35-
variant="zoom"
35+
variant="neutral"
3636
aria-label={intl.formatMessage({ id: "undo" })}
3737
onPress={actions?.undo}
3838
isDisabled={editorInfo.undo ? false : true}
@@ -41,7 +41,7 @@ const UndoRedoControls = ({ css: cssProp }: UndoRedoControlsProps) => {
4141
</IconButton>
4242
<IconButton
4343
isRound
44-
variant="zoom"
44+
variant="neutral"
4545
css={{ borderLeft: "1px solid", borderLeftColor: "gray.10" }}
4646
aria-label={intl.formatMessage({ id: "redo" })}
4747
onPress={actions?.redo}

src/editor/ZoomControls.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const ZoomControls = ({ size, css: cssProp }: ZoomControlsProps) => {
4747
<IconButton
4848
size={size}
4949
isRound
50-
variant="zoom"
50+
variant="neutral"
5151
aria-label={intl.formatMessage({ id: "zoom-out-action" })}
5252
onPress={handleZoomOut}
5353
>
@@ -57,7 +57,7 @@ const ZoomControls = ({ size, css: cssProp }: ZoomControlsProps) => {
5757
css={{ borderLeft: "1px solid", borderLeftColor: "gray.10" }}
5858
size={size}
5959
isRound
60-
variant="zoom"
60+
variant="neutral"
6161
aria-label={intl.formatMessage({ id: "zoom-in-action" })}
6262
onPress={handleZoomIn}
6363
>

src/project/ProjectAreaNav.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ const ProjectAreaNav = ({ css: cssProp }: ProjectAreaNavProps) => {
2020
<NewButton mode="button" />
2121
<OpenButton mode="button" />
2222
<Box>
23-
<ResetButton mode="button" variant="warning" css={{ mt: "5" }} />
23+
<ResetButton
24+
mode="button"
25+
variant="outline"
26+
tone="danger"
27+
css={{ mt: "5" }}
28+
/>
2429
</Box>
2530
</VStack>
2631
</Flex>

0 commit comments

Comments
 (0)