refactor(web): move the stylesheet into Tailwind utilities (#281)
This commit was merged in pull request #281.
This commit is contained in:
+18
-5
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { control, microControl } from "./look";
|
||||
|
||||
// The shared icon-only control block (#230), consumed by the title pages,
|
||||
// decks and readouts, the settings rows (#231) and the subtitle chips and
|
||||
@@ -64,9 +65,14 @@ const ICON_PATHS = {
|
||||
export type IconName = keyof typeof ICON_PATHS;
|
||||
|
||||
/** Stroke glyph on the shared 16-grid; the control's aria-label carries the meaning. */
|
||||
export function Icon({ name }: { name: IconName }) {
|
||||
export function Icon({ name, className }: { name: IconName; className?: string }) {
|
||||
return (
|
||||
<svg viewBox="0 0 16 16" className="icon" aria-hidden="true" data-icon={name}>
|
||||
<svg
|
||||
viewBox="0 0 16 16"
|
||||
className={className === undefined ? "icon" : `icon ${className}`}
|
||||
aria-hidden="true"
|
||||
data-icon={name}
|
||||
>
|
||||
{ICON_PATHS[name].map((d) => (
|
||||
<path key={d} d={d} />
|
||||
))}
|
||||
@@ -99,7 +105,7 @@ export function ProviderMark({ name }: { name: "tmdb" | "tvdb" | "imdb" | "rt" }
|
||||
/** The drawn star before a TMDB rating — no glyph standing in for an icon. */
|
||||
export function Star() {
|
||||
return (
|
||||
<svg viewBox="0 0 12 12" className="star" aria-hidden="true">
|
||||
<svg viewBox="0 0 12 12" className="size-lamp flex-none fill-ink" aria-hidden="true">
|
||||
<path d="M6 0.8 L7.5 4.2 L11.2 4.6 L8.4 7.1 L9.2 10.8 L6 8.9 L2.8 10.8 L3.6 7.1 L0.8 4.6 L4.5 4.2 Z" />
|
||||
</svg>
|
||||
);
|
||||
@@ -186,7 +192,11 @@ export function ArmedDeleteIcon({
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={compact ? "control-micro" : "control control-icon"}
|
||||
className={
|
||||
compact
|
||||
? microControl(armed)
|
||||
: control({ shape: "icon", danger: true, state: armed ? "armed" : null })
|
||||
}
|
||||
data-kind="delete"
|
||||
data-armed={armed ? "true" : undefined}
|
||||
aria-label={armed ? `confirm — ${label}` : label}
|
||||
@@ -202,7 +212,10 @@ export function ArmedDeleteIcon({
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name={armed ? "check" : "trash"} />
|
||||
<Icon
|
||||
name={armed ? "check" : "trash"}
|
||||
className={compact ? "size-3 [stroke-width:1.7]" : undefined}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user