Skip to content

Commit d72387c

Browse files
ironnyshbgrgicak
andauthored
Improve log modal styles, a11y, error message wording (#1369)
## What is this PR doing? - Removes the tabs from log messages - Adds a separation line between log messages - Modifies the CORS log message (copy polishes) - Replaces the `title` attribute with an `aria-label` (accessibility) ## What problem is it solving? > - [x] Remove the tabs from those and other log messages in Playground > - [x] Add a grey line between log messages to make it easier to distinguish between different entries See #1356 Fixes the inaccessible Search field. ## How is the problem addressed? - Updated the styles in the CSS file. - Edited the error message in _resources.ts_ - Updated the component code in _index.tsx_ ### To-do > - [ ] Maybe add a slight red background for severity error @bgrgicak, How are severity levels determined? --------- Co-authored-by: Bero <[email protected]>
1 parent 58ed77f commit d72387c

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

packages/playground/blueprints/src/lib/resources.ts

+12-16
Original file line numberDiff line numberDiff line change
@@ -229,30 +229,26 @@ export abstract class FetchResource extends Resource {
229229
throw new Error(
230230
`Could not download "${url}".
231231
Check if the URL is correct and the server is reachable.
232-
If the url is reachable, the server might be blocking the request.
233-
Check the console and network for more information.
232+
If it is reachable, the server might be blocking the request.
233+
Check the browser console and network tabs for more information.
234234
235-
## Does the console shows an error about "No 'Access-Control-Allow-Origin' header"?
235+
## Does the console show the error "No 'Access-Control-Allow-Origin' header"?
236236
237-
This means the server where your file is hosted does not allow requests from other sites
238-
(cross-origin requests, or CORS). You will need to move it to another server that allows
239-
cross-origin file downloads. You can learn more about CORS at
237+
This means the server that hosts your file does not allow requests from other sites
238+
(cross-origin requests, or CORS). You need to move the asset to a server that allows
239+
cross-origin file downloads. Learn more about CORS at
240240
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS.
241241
242-
If you're loading a file from https://github.com/, there's an easy fix – you can load it from
243-
raw.githubusercontent.com instead. Here's how to do that:
242+
If your file is on GitHub, load it from "raw.githubusercontent.com".
243+
Here's how to do that:
244244
245-
1. Start with the original GitHub URL for the file. For example:
246-
'''
247-
https://github.com/username/repository/blob/branch/filename
248-
'''
249-
2. Replace 'github.com' with 'raw.githubusercontent.com'.
250-
3. Remove the '/blob/' part of the URL.
245+
1. Start with the original GitHub URL of the file. For example:
246+
https://github.com/username/repository/blob/branch/filename.
247+
2. Replace "github.com" with "raw.githubusercontent.com".
248+
3. Remove the "/blob/" part of the URL.
251249
252250
The resulting URL should look like this:
253-
'''
254251
https://raw.githubusercontent.com/username/repository/branch/filename
255-
'''
256252
257253
Error:
258254
${e}`

packages/playground/website/src/components/log-modal/index.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ export function LogModal(props: { description?: JSX.Element; title?: string }) {
2929
)
3030
.reverse()
3131
.map((log, index) => (
32-
<pre className={css.logModalLog} key={index}>
33-
{log}
34-
</pre>
32+
<div
33+
className={css.logModalLog}
34+
key={index}
35+
dangerouslySetInnerHTML={{
36+
__html: log.replace(/Error:|Fatal:/, '<mark>$&</mark>'),
37+
}}
38+
/>
3539
));
3640
}
3741

@@ -45,7 +49,7 @@ export function LogModal(props: { description?: JSX.Element; title?: string }) {
4549
<h2>{props.title || 'Logs'}</h2>
4650
{props.description}
4751
<TextControl
48-
title="Search"
52+
aria-label="Search"
4953
placeholder="Search logs"
5054
value={searchTerm}
5155
onChange={setSearchTerm}

packages/playground/website/src/components/log-modal/style.module.css

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
}
99

1010
.log-modal__log {
11-
text-wrap: wrap;
11+
font-family: monospace;
1212
word-wrap: break-word;
13+
padding: 0.5rem 0;
1314
margin: 0.5rem 0;
15+
white-space-collapse: preserve-breaks;
16+
border-block-end: 1px dashed currentcolor;
17+
}
18+
19+
.log-modal__log:has(mark) {
20+
background-color: ivory;
1421
}

0 commit comments

Comments
 (0)