Skip to content

Commit c84afea

Browse files
committed
style: make use of more blueprint styles
https://blueprintjs.com/docs/#core/typography Also fix wrapping license text while we are touching this.
1 parent e6609b9 commit c84afea

File tree

8 files changed

+54
-24
lines changed

8 files changed

+54
-24
lines changed

src/alerts/UnexpectedErrorAlert.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
// Copyright (c) 2022 The Pybricks Authors
33

44
import './UnexpectedErrorAlert.scss';
5-
import { AnchorButton, Button, ButtonGroup, Collapse, Intent } from '@blueprintjs/core';
5+
import {
6+
AnchorButton,
7+
Button,
8+
ButtonGroup,
9+
Collapse,
10+
Intent,
11+
Pre,
12+
} from '@blueprintjs/core';
613
import React, { useState } from 'react';
714
import { useId } from 'react-aria';
815
import { CreateToast } from '../i18nToaster';
@@ -33,7 +40,7 @@ const UnexpectedErrorAlert: React.VoidFunctionComponent<UnexpectedErrorAlertProp
3340
<span id={labelId}>{i18n.translate('technicalInfo')}</span>
3441
</span>
3542
<Collapse isOpen={isExpanded}>
36-
<pre className="pb-alerts-stack-trace">{error.stack}</pre>
43+
<Pre className="pb-alerts-stack-trace">{error.stack}</Pre>
3744
</Collapse>
3845
<div>
3946
<ButtonGroup minimal={true} fill={true}>

src/ble/alerts/NoWebBluetooth.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
// Copyright (c) 2022 The Pybricks Authors
33

4-
import { Button, Intent } from '@blueprintjs/core';
4+
import { Button, Code, Intent } from '@blueprintjs/core';
55
import React from 'react';
66
import { CreateToast } from '../../i18nToaster';
77
import { isIOS, isLinux } from '../../utils/os';
@@ -19,9 +19,9 @@ const NoWebBluetooth: React.VoidFunctionComponent = () => {
1919
<>
2020
<p>{i18n.translate('noWebBluetooth.linux')}</p>
2121
<p>
22-
<code>
22+
<Code>
2323
chrome://flags/#enable-experimental-web-platform-features
24-
</code>
24+
</Code>
2525
<Button
2626
icon="duplicate"
2727
small={true}

src/explorer/fileNameFormGroup/FileNameFormGroup.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
// Copyright (c) 2022 The Pybricks Authors
33

4-
import { Classes, FormGroup, InputGroup, Intent, Tag } from '@blueprintjs/core';
4+
import { Classes, Code, FormGroup, InputGroup, Intent, Tag } from '@blueprintjs/core';
55
import type { AriaButtonProps } from '@react-types/button';
66
import React, { useCallback, useRef } from 'react';
77
import { useButton } from 'react-aria';
@@ -108,19 +108,19 @@ const FileNameHelpText: React.VoidFunctionComponent<FileNameHelpTextProps> = ({
108108
return (
109109
<>
110110
{i18n.translate('helpText.hasInvalidFirstCharacter', {
111-
letters: <code className={Classes.CODE}>a…z</code>,
112-
underscore: <code className={Classes.CODE}>_</code>,
111+
letters: <Code className={Classes.CODE}>a…z</Code>,
112+
underscore: <Code className={Classes.CODE}>_</Code>,
113113
})}
114114
</>
115115
);
116116
case FileNameValidationResult.HasInvalidCharacters:
117117
return (
118118
<>
119119
{i18n.translate('helpText.hasInvalidCharacters', {
120-
letters: <code className={Classes.CODE}>a…z</code>,
121-
numbers: <code className={Classes.CODE}>0…9</code>,
122-
dash: <code className={Classes.CODE}>-</code>,
123-
underscore: <code className={Classes.CODE}>_</code>,
120+
letters: <Code className={Classes.CODE}>a…z</Code>,
121+
numbers: <Code className={Classes.CODE}>0…9</Code>,
122+
dash: <Code className={Classes.CODE}>-</Code>,
123+
underscore: <Code className={Classes.CODE}>_</Code>,
124124
})}{' '}
125125
<FixItButton onPress={handleHasInvalidCharacters} />
126126
</>

src/firmware/installPybricksDialog/InstallPybricksDialog.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Callout,
88
Checkbox,
99
Classes,
10+
Code,
1011
ControlGroup,
1112
DialogStep,
1213
FormGroup,
@@ -17,6 +18,7 @@ import {
1718
MenuItem,
1819
MultistepDialog,
1920
NonIdealState,
21+
Pre,
2022
Spinner,
2123
Switch,
2224
} from '@blueprintjs/core';
@@ -69,12 +71,12 @@ const SelectHubPanel: React.VoidFunctionComponent = () => {
6971
popoverClassName={Classes2.POPOVER2_CONTENT_SIZING}
7072
placement="right-end"
7173
content={
72-
<div>
73-
<h3>
74+
<div className={Classes.RUNNING_TEXT}>
75+
<h4>
7476
{i18n.translate(
7577
'selectHubPanel.notOnListButton.info.mindstorms.title',
7678
)}
77-
</h3>
79+
</h4>
7880
<ul>
7981
<li>
8082
{i18n.translate(
@@ -92,11 +94,11 @@ const SelectHubPanel: React.VoidFunctionComponent = () => {
9294
)}
9395
</li>
9496
</ul>
95-
<h3>
97+
<h4>
9698
{i18n.translate(
9799
'selectHubPanel.notOnListButton.info.poweredUp.title',
98100
)}
99-
</h3>
101+
</h4>
100102
<ul>
101103
<li>
102104
{i18n.translate(
@@ -156,7 +158,7 @@ const AcceptLicensePanel: React.VoidFunctionComponent<AcceptLicensePanelProps> =
156158
<div className={dialogBody}>
157159
<div className="pb-firmware-installPybricksDialog-license-text">
158160
{data ? (
159-
<pre>{data.licenseText}</pre>
161+
<Pre>{data.licenseText}</Pre>
160162
) : (
161163
<NonIdealState
162164
icon={error ? 'error' : <Spinner />}
@@ -247,7 +249,7 @@ const ConfigureOptionsPanel: React.VoidFunctionComponent<SelectOptionsPanelProps
247249
<Switch
248250
labelElement={i18n.translate(
249251
'optionsPanel.customMain.include.label',
250-
{ main: <code>main.py</code> },
252+
{ main: <Code>main.py</Code> },
251253
)}
252254
checked={includeProgram}
253255
onChange={(e) =>

src/firmware/installPybricksDialog/installPybricksDialog.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
& .#{bp.$ns}-non-ideal-state {
2424
min-height: bp.$pt-grid-size * 35;
2525
}
26+
27+
& pre {
28+
white-space: pre-wrap;
29+
word-break: keep-all;
30+
margin: 0;
31+
}
2632
}
2733

2834
&-checkbox {

src/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ a.#{bp.$ns}-button {
136136
min-width: math.div(bp.$pt-grid-size, 2);
137137
}
138138

139+
.#{bp.$ns}-running-text h4:first-child {
140+
margin-top: 0;
141+
}
142+
139143
// make scrollbars fit our style
140144
::-webkit-scrollbar {
141145
width: 16px;

src/licenses/LicenseDialog.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Classes,
1111
Dialog,
1212
NonIdealState,
13+
Pre,
1314
Spinner,
1415
Text,
1516
} from '@blueprintjs/core';
@@ -190,7 +191,7 @@ const LicenseInfoPanel = React.forwardRef<HTMLDivElement, LicenseInfoPanelProps>
190191
{i18n.translate('help.selectPackage')}
191192
</NonIdealState>
192193
) : (
193-
<div>
194+
<>
194195
<Card>
195196
<p>
196197
<strong>{i18n.translate('packageLabel')}</strong>{' '}
@@ -211,9 +212,9 @@ const LicenseInfoPanel = React.forwardRef<HTMLDivElement, LicenseInfoPanelProps>
211212
</p>
212213
</Card>
213214
<div className="pb-license-text">
214-
<pre>{licenseInfo.licenseText}</pre>
215+
<Pre>{licenseInfo.licenseText}</Pre>
215216
</div>
216-
</div>
217+
</>
217218
)}
218219
</div>
219220
);

src/licenses/license.scss

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,19 @@
5050
.pb-license-info {
5151
width: 80%;
5252
padding: 0px 16px;
53-
overflow: auto;
53+
54+
display: flex;
55+
flex-direction: column;
56+
gap: bp.$pt-grid-size;
5457
}
5558

5659
.pb-license-text {
57-
padding: 0px 16px;
60+
overflow: auto;
61+
min-height: 0;
62+
63+
& pre {
64+
white-space: pre-wrap;
65+
word-break: keep-all;
66+
margin: 0;
67+
}
5868
}

0 commit comments

Comments
 (0)