style: square the corners of the web app
The base radius goes from 8 px to 2 px, which squares buttons, fields, dialogs, covers and cards at once. The things that were made round on purpose are square now too: the play button, the switch and its knob, the chip of a friend, the bars of the statistics, the tab marker, the dot of a request, and the volume slider (a thin track and a bar for a knob). The rings of a missing cover stay round: they are the drawing of Sonda.
This commit is contained in:
parent
c5f548e74e
commit
9bf6fd0039
11 changed files with 51 additions and 16 deletions
|
|
@ -13,7 +13,7 @@ export default function FriendChip({ friend, className }: { friend: number; clas
|
|||
return (
|
||||
<span
|
||||
aria-label={t('player.fromFriend', { name })}
|
||||
className={cn('shrink-0 rounded-full border border-friend px-2.5 text-[13px] leading-5 font-semibold text-friend', className)}
|
||||
className={cn('shrink-0 rounded-md border border-friend px-2.5 text-[13px] leading-5 font-semibold text-friend', className)}
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ export function ShareBars({ label, bars, wide = false }: { label: string; bars:
|
|||
{bars.map((b) => (
|
||||
<li key={b.key} className={cn('grid items-center gap-3', wide ? 'grid-cols-[minmax(9rem,20rem)_1fr_3.5rem]' : 'grid-cols-[minmax(6rem,10rem)_1fr_3.5rem]')}>
|
||||
<span className="min-w-0 truncate font-medium first-letter:uppercase">{b.label}</span>
|
||||
<span aria-hidden="true" className="h-2 overflow-hidden rounded-full bg-card">
|
||||
<span className="block h-full rounded-full bg-primary" style={{ width: `${Math.min(1, Math.max(0, b.value)) * 100}%` }} />
|
||||
<span aria-hidden="true" className="h-2 overflow-hidden rounded-sm bg-card">
|
||||
<span className="block h-full rounded-sm bg-primary" style={{ width: `${Math.min(1, Math.max(0, b.value)) * 100}%` }} />
|
||||
</span>
|
||||
<span className="text-right text-sm tabular-nums text-muted-foreground">{b.text}</span>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import type { CSSProperties } from 'react'
|
||||
import { Volume1, Volume2, VolumeX } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
|
@ -31,7 +32,8 @@ export default function VolumeControl({ className }: { className?: string }) {
|
|||
aria-label={t('player.volume')}
|
||||
aria-valuetext={`${percent}%`}
|
||||
onChange={(e) => setVolume(Number(e.target.value) / 100)}
|
||||
className="h-11 w-24 cursor-pointer accent-primary max-sm:hidden"
|
||||
style={{ "--fill": `${percent}%` } as CSSProperties}
|
||||
className="slider h-11 w-24 cursor-pointer max-sm:hidden"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default function PhoneTabs() {
|
|||
<span
|
||||
data-bar
|
||||
aria-hidden="true"
|
||||
className={cn('h-[3px] w-6 rounded-full', tab.current ? ('friend' in tab ? 'bg-friend' : 'bg-primary') : 'bg-transparent')}
|
||||
className={cn('h-[3px] w-6', tab.current ? ('friend' in tab ? 'bg-friend' : 'bg-primary') : 'bg-transparent')}
|
||||
/>
|
||||
<span>{tab.label}</span>
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -424,11 +424,11 @@ test('the bar has a heart for a song of this server, and none for a friend’s',
|
|||
expect(screen.queryByRole('button', { name: /favourites/ })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
test('the play button is round, and teal for this server’s music', () => {
|
||||
test('the play button is square-cornered, and teal for this server’s music', () => {
|
||||
act(() => usePlayer.getState().playTracks([a]))
|
||||
renderBar()
|
||||
const play = screen.getByRole('button', { name: 'Pause' })
|
||||
expect(play).toHaveClass('rounded-full', 'bg-primary')
|
||||
expect(play).toHaveClass('rounded-md', 'bg-primary')
|
||||
expect(play).not.toHaveClass('bg-friend')
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default function PlayerControls({ large = false, className }: { large?: b
|
|||
<Button
|
||||
className={cn(
|
||||
large ? 'size-[72px]' : 'size-12',
|
||||
'rounded-full',
|
||||
'rounded-md',
|
||||
friend && 'bg-friend text-friend-foreground hover:bg-friend/80',
|
||||
)}
|
||||
aria-label={playing ? t('player.pause') : t('player.play')}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ interface SwitchProps extends Omit<ComponentProps<'button'>, 'role' | 'type' | '
|
|||
checked: boolean
|
||||
}
|
||||
|
||||
/** An on/off switch: a pill with a round knob. The button is 44 pixels high so that a thumb finds it; the track drawn inside is 32. */
|
||||
/** An on/off switch: a rectangle with a square knob. The button is 44 pixels high so that a thumb finds it; the track drawn inside is 32. */
|
||||
export function Switch({ checked, className, ...props }: SwitchProps) {
|
||||
return (
|
||||
<button
|
||||
|
|
@ -13,7 +13,7 @@ export function Switch({ checked, className, ...props }: SwitchProps) {
|
|||
role="switch"
|
||||
aria-checked={checked}
|
||||
className={cn(
|
||||
'group flex h-11 w-14 shrink-0 items-center rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50',
|
||||
'group flex h-11 w-14 shrink-0 items-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
@ -21,13 +21,13 @@ export function Switch({ checked, className, ...props }: SwitchProps) {
|
|||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
'relative h-8 w-full rounded-full border border-input transition-colors',
|
||||
'relative h-8 w-full rounded-md border border-input transition-colors',
|
||||
checked ? 'border-primary bg-primary' : 'bg-secondary',
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'absolute top-0.5 left-0.5 size-6 rounded-full transition-transform motion-reduce:transition-none',
|
||||
'absolute top-0.5 left-0.5 size-6 rounded-sm transition-transform motion-reduce:transition-none',
|
||||
checked ? 'translate-x-6 bg-primary-foreground' : 'bg-muted-foreground',
|
||||
)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
|
||||
:root {
|
||||
--radius: 0.5rem;
|
||||
--radius: 0.125rem;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
|
|
@ -99,3 +99,36 @@
|
|||
.lift img { transition: transform 200ms ease-out; }
|
||||
.lift:hover img { transform: scale(1.03); }
|
||||
}
|
||||
|
||||
/* The volume slider has square corners like the rest: a thin track filled up to the knob, and a bar for a knob. The
|
||||
browser's own slider is round, and no setting makes it square. */
|
||||
.slider {
|
||||
appearance: none;
|
||||
background: transparent;
|
||||
}
|
||||
.slider::-webkit-slider-runnable-track {
|
||||
height: 4px;
|
||||
background: linear-gradient(to right, var(--primary) var(--fill), var(--input) var(--fill));
|
||||
}
|
||||
.slider::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
width: 8px;
|
||||
height: 18px;
|
||||
margin-top: -7px;
|
||||
background: var(--primary);
|
||||
}
|
||||
.slider::-moz-range-track {
|
||||
height: 4px;
|
||||
background: var(--input);
|
||||
}
|
||||
.slider::-moz-range-progress {
|
||||
height: 4px;
|
||||
background: var(--primary);
|
||||
}
|
||||
.slider::-moz-range-thumb {
|
||||
width: 8px;
|
||||
height: 18px;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: var(--primary);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function Row({ request }: { request: LidarrRequest }) {
|
|||
<span className="text-sm text-muted-foreground">{t('requests.sent', { when: day.format(new Date(request.requested_at)) })}</span>
|
||||
</div>
|
||||
<span className={cn('flex items-center gap-2 text-sm font-semibold', arrived ? 'text-foreground' : 'text-muted-foreground')}>
|
||||
<span aria-hidden="true" className={cn('size-2 rounded-full', arrived ? 'bg-primary' : 'border border-muted-foreground')} />
|
||||
<span aria-hidden="true" className={cn('size-2 rounded-sm', arrived ? 'bg-primary' : 'border border-muted-foreground')} />
|
||||
{arrived ? t('requests.arrived', { when: day.format(new Date(request.arrived_at ?? request.requested_at)) }) : t('requests.waiting')}
|
||||
</span>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default function FederationFriends({ friends }: { friends: FederationFrie
|
|||
<div className="flex min-w-0 flex-col gap-1">
|
||||
<span className="flex flex-wrap items-center gap-3">
|
||||
<span className="text-xl font-bold">{friend.name}</span>
|
||||
<span className="rounded-full border border-friend px-3 text-[13px] font-semibold text-friend">
|
||||
<span className="rounded-md border border-friend px-3 text-[13px] font-semibold text-friend">
|
||||
{t(`admin.federation.state.${friend.state}`)}
|
||||
</span>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ test('the key of this server is big and in groups of four, in the colour of this
|
|||
test('the state of a friend is a pill in the friend colour', async () => {
|
||||
server({ enabled: true, key_id: 'abcdef0123456789', friends: [friend({ name: 'Bruno', state: 'incoming', approved_at: null })] })
|
||||
renderPage()
|
||||
expect(await screen.findByText('Wants to be your friend')).toHaveClass('border-friend', 'text-friend', 'rounded-full')
|
||||
expect(await screen.findByText('Wants to be your friend')).toHaveClass('border-friend', 'text-friend', 'rounded-md')
|
||||
})
|
||||
|
||||
test('the parts are divided by lines, not put in boxes', async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue