Skip to content

Commit ea1b0b7

Browse files
committed
Update workbox for reload button in Offline page to work correctly
1 parent 7088948 commit ea1b0b7

20 files changed

Lines changed: 657 additions & 189 deletions

File tree

.cache/pages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"consent",
9090
"contact",
9191
"hero",
92+
"newsletter",
9293
"offline",
9394
{
9495
"privacy": [

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,26 @@
7878
"EXIF",
7979
"fastly",
8080
"Favicons",
81+
"Fbad",
8182
"fbclid",
83+
"Fcontact",
8284
"Fedi",
8385
"Fedibird",
8486
"Fediverse",
8587
"FERPA",
88+
"Fevil",
8689
"finnadie",
8790
"firko",
8891
"Flink",
8992
"flowid",
9093
"fluxcd",
9194
"FNAME",
95+
"Foffline",
9296
"fosstodon",
9397
"FOUC",
98+
"Fphish",
9499
"fprintf",
100+
"Fprivacy",
95101
"Fulcio",
96102
"gantt",
97103
"gclid",

src/components/List/index.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import PlainIconList from '@components/List/layouts/PlainIconList.astro'
1010
import SideBySideList from '@components/List/layouts/SideBySideList.astro'
1111
import TimelineList from '@components/List/layouts/TimelineList.astro'
1212
import TwoColumnCheckIconsList from '@components/List/layouts/TwoColumnCheckIconsList.astro'
13+
import TwoColumnIconList from '@components/List/layouts/TwoColumnIconList.astro'
1314
import ZebraList from '@components/List/layouts/ZebraList.astro'
1415
1516
export type Props = {
@@ -19,6 +20,7 @@ export type Props = {
1920
text: string
2021
icon?: string
2122
color?: string
23+
inverseColor?: string
2224
}[]
2325
classes?: {
2426
ol?: string
@@ -39,11 +41,13 @@ const itemsWithColor = items as Array<{
3941
text: string
4042
icon?: string
4143
color: string
44+
inverseColor?: string
4245
}>
4346
const itemsWithIconAndColor = items as Array<{
4447
text: string
4548
icon: string
4649
color: string
50+
inverseColor?: string
4751
}>
4852
---
4953

@@ -58,4 +62,5 @@ const itemsWithIconAndColor = items as Array<{
5862
{variant === 'side-by-side-list' && <SideBySideList items={items} {...classesProps} />}
5963
{variant === 'timeline-list' && <TimelineList items={items} {...classesProps} />}
6064
{variant === 'two-column-check-icons-list' && <TwoColumnCheckIconsList items={items} {...classesProps} {...sizeProps} />}
65+
{variant === 'two-column-icon-list' && <TwoColumnIconList items={itemsWithIconAndColor} {...classesProps} {...sizeProps} />}
6166
{variant === 'zebra-list' && <ZebraList items={items} {...classesProps} />}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
import Marker from "@components/Marker/index.astro"
3+
4+
export type Props = {
5+
items: {
6+
title?: string
7+
text: string
8+
icon?: string
9+
color: string
10+
inverseColor?: string
11+
}[]
12+
classes?: {
13+
ul?: string
14+
li?: string
15+
em?: string
16+
}
17+
size?: number
18+
}
19+
20+
const { items, classes, size }: Props = Astro.props
21+
22+
const ulClass = ["grid md:grid-cols-2 gap-6", classes?.ul].filter(Boolean).join(" ")
23+
const liClass = ["flex items-start gap-2", classes?.li].filter(Boolean).join(" ")
24+
const iconWrapper = "shrink-0 w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mt-1"
25+
const contentWrapper = ["text-page-inverse mb-1 ml-2", classes?.em].filter(Boolean).join(" ")
26+
const textClass = "text-sm"
27+
---
28+
29+
<ul class={ulClass}>
30+
{
31+
items.map((item) => {
32+
const icon = item.icon ?? "check"
33+
34+
return (
35+
<li class={liClass}>
36+
<div class={iconWrapper}>
37+
<Marker
38+
icon={icon}
39+
color={item.color}
40+
size={size ?? 6}
41+
/>
42+
</div>
43+
<div class={contentWrapper}>
44+
<h3 class="font-sans text-xl">{item.title}</h3>
45+
<p class={textClass}>{item.text}</p>
46+
</div>
47+
</li>
48+
)
49+
})
50+
}
51+
</ul>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
export type Props = {
3+
color: string
4+
classes?: string
5+
size: number
6+
accessible: boolean
7+
focusable: boolean
8+
isListMarker?: boolean
9+
}
10+
11+
const { color, classes, size, accessible, focusable, isListMarker } = Astro.props
12+
---
13+
14+
<svg
15+
xmlns="http://www.w3.org/2000/svg"
16+
class:list={["shrink-0", `w-${size} h-${size}`, `text-${color}`, classes, isListMarker ? "mt-0.5" : ""]}
17+
fill="none"
18+
stroke="currentColor"
19+
viewBox="0 0 24 24"
20+
aria-hidden={accessible ? "false" : "true"}
21+
focusable={focusable ? "true" : "false"}
22+
>
23+
{accessible && <title>Map Icon</title>}
24+
<path
25+
stroke-linecap="round"
26+
stroke-linejoin="round"
27+
stroke-width="2"
28+
d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
29+
></path>
30+
</svg>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
export type Props = {
3+
color: string
4+
classes?: string
5+
size: number
6+
accessible: boolean
7+
focusable: boolean
8+
isListMarker?: boolean
9+
}
10+
11+
const { color, classes, size, accessible, focusable, isListMarker } = Astro.props
12+
---
13+
14+
<svg
15+
xmlns="http://www.w3.org/2000/svg"
16+
class:list={["shrink-0", `w-${size} h-${size}`, `text-${color}`, classes, isListMarker ? "mt-0.5" : ""]}
17+
fill="none"
18+
stroke="currentColor"
19+
viewBox="0 0 24 24"
20+
aria-hidden={accessible ? "false" : "true"}
21+
focusable={focusable ? "true" : "false"}
22+
>
23+
{accessible && <title>Question Mark in Circle Icon</title>}
24+
<path
25+
stroke-linecap="round"
26+
stroke-linejoin="round"
27+
stroke-width="2"
28+
d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
29+
></path>
30+
</svg>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
export type Props = {
3+
color: string
4+
classes?: string
5+
size: number
6+
accessible: boolean
7+
focusable: boolean
8+
isListMarker?: boolean
9+
}
10+
11+
const { color, classes, size, accessible, focusable, isListMarker } = Astro.props
12+
---
13+
14+
<svg
15+
xmlns="http://www.w3.org/2000/svg"
16+
class:list={["shrink-0", `w-${size} h-${size}`, `text-${color}`, classes, isListMarker ? "mt-0.5" : ""]}
17+
fill="none"
18+
stroke="currentColor"
19+
viewBox="0 0 24 24"
20+
aria-hidden={accessible ? "false" : "true"}
21+
focusable={focusable ? "true" : "false"}
22+
>
23+
{accessible && <title>Reload Icon</title>}
24+
<path
25+
stroke-linecap="round"
26+
stroke-linejoin="round"
27+
stroke-width="2"
28+
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
29+
></path>
30+
</svg>

src/components/Marker/icons/waiting.astro

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { color, classes, size, accessible, focusable } = Astro.props
1313
<svg
1414
xmlns="http://www.w3.org/2000/svg"
1515
class:list={[`w-${size} h-${size}`, `text-${color}`, classes]}
16-
fill="none"
16+
fill="currentColor"
1717
stroke="currentColor"
1818
viewBox="0 0 24 24"
1919
aria-hidden={accessible ? "false" : "true"}
@@ -31,3 +31,20 @@ const { color, classes, size, accessible, focusable } = Astro.props
3131
<line x1="4.93" y1="4.93" x2="7.76" y2="7.76" opacity="1"></line>
3232
</g>
3333
</svg>
34+
35+
<style>
36+
@keyframes offline-spin {
37+
from {
38+
transform: rotate(0deg);
39+
}
40+
41+
to {
42+
transform: rotate(360deg);
43+
}
44+
}
45+
46+
.offline-spinner-bars {
47+
animation: offline-spin 1.2s steps(8, end) infinite;
48+
transform-origin: center;
49+
}
50+
</style>

src/components/Marker/index.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export type Props = {
1010
* apply the value to their stroke and fill attributes as appropriate for the image.
1111
*/
1212
color?: string
13+
/** A color for the icon to use for internal fill areas */
14+
inverseColor?: string
1315
/** Defaults to 24. */
1416
size?: number
1517
/** Any additional CSS classes to apply to the SVG element. */
@@ -25,10 +27,11 @@ export type Props = {
2527
isListMarker?: boolean
2628
}
2729
28-
const { icon, color = 'inherit', size = 14, classes, accessible = false, focusable = false, isListMarker = true }: Props = Astro.props
30+
const { icon, color = 'inherit', inverseColor, size = 14, classes, accessible = false, focusable = false, isListMarker = true }: Props = Astro.props
2931
3032
const MarkerComponent = getMarkerComponent(icon) as unknown as (_props: {
3133
color?: string
34+
inverseColor?: string
3235
size?: number
3336
classes?: string
3437
accessible?: boolean
@@ -38,6 +41,7 @@ const MarkerComponent = getMarkerComponent(icon) as unknown as (_props: {
3841
3942
const markerProps = {
4043
...(color ? { color } : {}),
44+
...(inverseColor ? { inverseColor } : {}),
4145
...(size !== undefined ? { size } : {}),
4246
...(classes ? { classes } : {}),
4347
...(accessible ? { accessible } : {}),

src/components/Marker/server/__tests__/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest'
22
import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
3-
import { getMarkerComponent } from '@components/List/server'
3+
import { getMarkerComponent } from '@components/Marker/server'
44

55
const downloadMarker = (() => null) as unknown as AstroComponentFactory
66
const avatarMarker = (() => null) as unknown as AstroComponentFactory

0 commit comments

Comments
 (0)