mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 14:49:10 +03:00
* Change all imports in the ui package which import via the @ui shortcut. * Add a new ui-patterns package. Add it to all apps. * Migrate PrivacySettings from ui to ui-patterns. * Migrate ConsentToast from ui to ui-patterns. * Remove providers folder from ui package. * Move GlassPanel. * Migrate IconPanel. * Migrate TweetCard. * Migrate ThemeImage. * Remove LWXCountdownBanner. * Migrate CountdownWidget. * Migrate SchemaTableNode. * Migrate ExpandableVideo. * Migrate ThemeToggle. * Fix bunch of imports in the docs app. * Revert some unnecessary changes. * Expand the README.md. * Fix the tailwind configs, they were using old folder structure. * Fix leftover merge conflicts. * Remove a deleted page in master. --------- Co-authored-by: Terry Sutton <saltcod@gmail.com>
36 lines
769 B
TypeScript
36 lines
769 B
TypeScript
import React from 'react'
|
|
import Countdown from 'react-countdown'
|
|
import { CountdownWidget } from 'ui-patterns/CountdownWidget'
|
|
|
|
const CountdownComponent = ({
|
|
date,
|
|
showCard = true,
|
|
}: {
|
|
date: string | number | Date
|
|
showCard?: boolean
|
|
}) => {
|
|
if (!date) return null
|
|
|
|
const renderer = ({ days, hours, minutes, seconds, completed }: any) => {
|
|
if (completed) {
|
|
// Render a completed state
|
|
return null
|
|
} else {
|
|
// Render countdown
|
|
return (
|
|
<CountdownWidget
|
|
days={days}
|
|
hours={hours}
|
|
minutes={minutes}
|
|
seconds={seconds}
|
|
showCard={showCard}
|
|
/>
|
|
)
|
|
}
|
|
}
|
|
|
|
return <Countdown date={new Date(date)} renderer={renderer} />
|
|
}
|
|
|
|
export default CountdownComponent
|