Files
supabase/packages/ui-patterns/CountdownWidget/CountdownStep.tsx
T
1358b6574b feat: lw14 mamba day 1 (#34567)
* feat: mamba d1 init

* feat: ticketview less narrow

* chore: d1 setup

* Add D1 blog post

* Add images

* chore: d1 setup

* chore: add blog post link

* chore: add youtube link

* chore: build stage links

* chore: lw summary in blog post

* chore: lw summary in blog post

* chore: update banners

* chore: update PromoToast

* Add new imgs

* spelling

* Re-export images

* fix rss

* Re-export images

* Minor fixes.

* Update tags

* Reorder posts

* update unrelated rss

* blog post edits

* chore: update countdown

* chore: claim redirect to ticket section

* smol cleanup

* blog images

* add yt embed in blog post

* link to gh discussion

* fix: youtube video embed

---------

Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-03-31 14:26:31 +00:00

49 lines
1.2 KiB
TypeScript

'use client'
import { useEffect, useState } from 'react'
import { cn } from 'ui'
interface CountdownStepProps {
value: string | number
unit: string
showCard?: boolean
size?: 'small' | 'large'
}
function CountdownStep({ value, unit, showCard = true, size = 'small' }: CountdownStepProps) {
const isLarge = size === 'large'
const [isMounted, setIsMounted] = useState(false)
const valueWithZero = (value as number) > 9 ? value : '0' + value
useEffect(() => {
setIsMounted(true)
}, [])
if (!isMounted) return null
return (
<div
className={cn(
'uppercase tracking-[0.05rem] text-sm',
showCard
? 'rounded-md p-[1px] overflow-hidden bg-gradient-to-b from-border-muted to-border-muted/20'
: 'tracking-[0.1rem]',
isLarge && 'text-lg'
)}
>
<div
className={cn(
showCard
? 'py-1 px-2 rounded-md w-11 leading-4 flex items-center justify-center bg-black backdrop-blur-md'
: cn('flex items-center justify-center w-7 py-1 px-1', isLarge && 'w-9')
)}
>
<span className="m-0">{valueWithZero}</span>
<span>{unit}</span>
</div>
</div>
)
}
export default CountdownStep