Skip to content

Commit fc16a63

Browse files
authored
Use native not-*, has-*, nth-last-*, etc instead of arbitrary (#20)
2 parents e2008ab + fe9b2f4 commit fc16a63

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/components/ServiceDayTooltip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class ServiceDayTooltip extends Component {
7171

7272
return html`
7373
<div
74-
class="absolute -inset-x-2 top-full z-50 rounded-xl bg-neutral-800 shadow-md ring-1 ring-white/10 ring-inset group-[:not(:hover):not(:focus-visible):not(:has(:focus-visible))]/bar:sr-only"
74+
class="absolute -inset-x-2 top-full z-50 rounded-xl bg-neutral-800 shadow-md ring-1 ring-white/10 ring-inset not-group-hover/bar:not-group-focus-visible/bar:not-group-has-focus-visible/bar:sr-only"
7575
>
7676
<div
7777
class="grid grid-cols-3 items-center border-b border-white/10 px-3 py-2 leading-none"
@@ -120,7 +120,7 @@ export class ServiceDayTooltip extends Component {
120120
>
121121
</svg>
122122
<span
123-
class="absolute top-full left-0 z-50 mt-1 block w-max rounded-lg bg-neutral-800 px-2 py-1 text-sm leading-normal font-medium text-white shadow-md ring-1 ring-white/10 ring-inset group-[:not(:hover)]/indicator:sr-only lg:-top-1 lg:-left-1 lg:mt-0 lg:-translate-x-full"
123+
class="absolute top-full left-0 z-50 mt-1 block w-max rounded-lg bg-neutral-800 px-2 py-1 text-sm leading-normal font-medium text-white shadow-md ring-1 ring-white/10 ring-inset not-group-hover/indicator:sr-only lg:-top-1 lg:-left-1 lg:mt-0 lg:-translate-x-full"
124124
>${style.label}</span>
125125
</div>
126126
<a

src/components/ServiceRow.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ export class ServiceRow extends Component {
122122
const worst = presentNotices.reduce((w, n) => n.impact > w.impact ? n : w);
123123
return html`
124124
<div
125-
class="group/bar flex outline-offset-2 outline-blue-400 [:has(:focus-visible)]:z-10 [:has(:focus-visible)]:outline-2"
125+
class="group/bar flex outline-offset-2 outline-blue-400 has-focus-visible:z-10 has-focus-visible:outline-2"
126126
>
127127
<div
128128
class="size-full ${ServiceRow.STATUS_STYLES[worst.impact]
129-
.bar} group-first/bar:rounded-l-sm group-nth-61/bar:rounded-l-sm sm:group-nth-61/bar:rounded-l-none sm:group-nth-31/bar:rounded-l-sm md:group-nth-31/bar:rounded-l-none group-last/bar:rounded-r-sm group-hover/bar:brightness-70 group-[:has(:focus-visible)]/bar:brightness-70"
129+
.bar} group-first/bar:rounded-l-sm group-nth-61/bar:rounded-l-sm sm:group-nth-61/bar:rounded-l-none sm:group-nth-31/bar:rounded-l-sm md:group-nth-31/bar:rounded-l-none group-last/bar:rounded-r-sm group-hover/bar:brightness-70 group-has-focus-visible/bar:brightness-70"
130130
>
131131
</div>
132132
${new ServiceDayTooltip(notices, day, started)}
@@ -194,7 +194,7 @@ export class ServiceRow extends Component {
194194
>
195195
</svg>
196196
<span
197-
class="absolute top-full left-0 z-50 mt-1 block w-max rounded-lg bg-neutral-800 px-2 py-1 text-sm leading-normal font-medium text-white shadow-md ring-1 ring-white/10 ring-inset group-[:not(:hover)]/indicator:sr-only lg:-top-1 lg:-left-1 lg:mt-0 lg:-translate-x-full"
197+
class="absolute top-full left-0 z-50 mt-1 block w-max rounded-lg bg-neutral-800 px-2 py-1 text-sm leading-normal font-medium text-white shadow-md ring-1 ring-white/10 ring-inset not-group-hover/indicator:sr-only lg:-top-1 lg:-left-1 lg:mt-0 lg:-translate-x-full"
198198
>${style.label}</span>
199199
</span>
200200
`;
@@ -222,7 +222,7 @@ export class ServiceRow extends Component {
222222
</path>
223223
</svg>
224224
<div
225-
class="prose prose-neutral prose-invert prose-sm top-full left-0 absolute z-50 block w-max rounded-lg bg-neutral-800 px-2 py-1 text-white font-medium shadow-md ring-1 ring-white/10 ring-inset group-[:not(:hover)]/description:sr-only lg:-top-2 lg:left-full lg:mt-0 lg:translate-x-1 max-w-sm"
225+
class="prose prose-neutral prose-invert prose-sm top-full left-0 absolute z-50 block w-max rounded-lg bg-neutral-800 px-2 py-1 text-white font-medium shadow-md ring-1 ring-white/10 ring-inset not-group-hover/description:sr-only lg:-top-2 lg:left-full lg:mt-0 lg:translate-x-1 max-w-sm"
226226
>
227227
${unsafeHTML(
228228
ServiceRow.MD.render(this.service.description),
@@ -266,7 +266,7 @@ export class ServiceRow extends Component {
266266

267267
return html`
268268
<div
269-
class="relative mt-2 grid h-8 grid-cols-30 rounded-sm *:border-r *:border-neutral-900 *:last:border-r-0 sm:grid-cols-60 md:grid-cols-90 [&>:not(:nth-last-child(-n+30))]:max-sm:hidden [&>:not(:nth-last-child(-n+60))]:max-md:hidden"
269+
class="relative mt-2 grid h-8 grid-cols-30 rounded-sm *:border-r *:border-neutral-900 *:last:border-r-0 sm:grid-cols-60 md:grid-cols-90 max-sm:*:not-nth-last-[-n+30]:hidden max-md:*:not-nth-last-[-n+60]:hidden"
270270
>
271271
${bars}
272272
</div>

0 commit comments

Comments
 (0)