2025-04-01 16:15:20 +02:00
|
|
|
import React from 'react'
|
|
|
|
import { Link } from '@freesewing/react/components/Link'
|
|
|
|
import {
|
|
|
|
SettingsIcon,
|
|
|
|
ControlIcon,
|
|
|
|
NewsletterIcon,
|
|
|
|
UnitsIcon,
|
|
|
|
CompareIcon,
|
|
|
|
DocsIcon,
|
|
|
|
UserIcon,
|
|
|
|
LeftIcon,
|
|
|
|
OkIcon,
|
|
|
|
NoIcon,
|
|
|
|
ShowcaseIcon,
|
|
|
|
} from '@freesewing/react/components/Icon'
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A component to display a row of data
|
|
|
|
*/
|
2025-04-18 08:07:13 +00:00
|
|
|
export const DisplayRow = ({ title, children, keyWidth = 'tw:w-24' }) => (
|
|
|
|
<div className="tw:flex tw:flex-row tw:flex-wrap tw:items-center tw:lg:gap-4 tw:my-2 tw:w-full">
|
2025-04-01 16:15:20 +02:00
|
|
|
<div
|
2025-04-18 08:07:13 +00:00
|
|
|
className={`${keyWidth} tw:text-left tw:md:text-right tw:block tw:md:inline tw:font-bold tw:pr-4 tw:shrink-0`}
|
2025-04-01 16:15:20 +02:00
|
|
|
>
|
|
|
|
{title}
|
|
|
|
</div>
|
2025-04-18 08:07:13 +00:00
|
|
|
<div className="tw:grow">{children}</div>
|
2025-04-01 16:15:20 +02:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
export const welcomeSteps = {
|
|
|
|
1: [''],
|
|
|
|
2: ['', 'newsletter', 'units'],
|
|
|
|
3: ['', 'newsletter', 'units', 'compare', 'username'],
|
|
|
|
4: ['', 'newsletter', 'units', 'compare', 'username', 'bio', 'img'],
|
|
|
|
5: [''],
|
|
|
|
}
|
|
|
|
|
|
|
|
export const WelcomeDoneIcon = ({ href }) => (
|
2025-04-18 08:07:13 +00:00
|
|
|
<Link href={`/welcome/${href}`} className="tw:text-success tw:hover:text-secondary">
|
2025-04-01 16:15:20 +02:00
|
|
|
<WelcomeTopicIcon href={href} />
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
export const WelcomeTodoIcon = ({ href }) => (
|
|
|
|
<Link
|
|
|
|
href={`/welcome/${href}`}
|
2025-04-18 08:07:13 +00:00
|
|
|
className="tw:text-secondary tw:w-6 tw:h-6 tw:opacity-50 tw:hover:opacity-100"
|
2025-04-01 16:15:20 +02:00
|
|
|
>
|
|
|
|
<WelcomeTopicIcon href={href} />
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
|
|
|
|
const WelcomeTopicIcon = (props) => {
|
|
|
|
const Icon =
|
|
|
|
props.href === '' || props.href === 'control'
|
|
|
|
? ControlIcon
|
|
|
|
: icons[props.href]
|
|
|
|
? icons[props.href]
|
|
|
|
: SettingsIcon
|
|
|
|
|
|
|
|
return <Icon {...props} />
|
|
|
|
}
|
|
|
|
|
|
|
|
const WelcomeDoingIcon = ({ href }) => (
|
2025-04-18 08:07:13 +00:00
|
|
|
<WelcomeTopicIcon href={href} className="tw:w-6 tw:h-6 tw:text-base-content" />
|
2025-04-01 16:15:20 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
export const WelcomeIcons = ({ done = [], todo = [], current = '' }) => (
|
2025-04-18 08:07:13 +00:00
|
|
|
<div className="tw:m-auto tw:flex tw:flex-row tw:items-center tw:justify-center tw:gap-2">
|
2025-04-01 16:15:20 +02:00
|
|
|
{done.map((href) => (
|
|
|
|
<WelcomeDoneIcon href={href} key={href} />
|
|
|
|
))}
|
|
|
|
<WelcomeDoingIcon href={current} />
|
|
|
|
{todo.map((href) => (
|
|
|
|
<WelcomeTodoIcon href={href} key={href} />
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
const icons = {
|
|
|
|
newsletter: NewsletterIcon,
|
|
|
|
units: UnitsIcon,
|
|
|
|
compare: CompareIcon,
|
|
|
|
username: UserIcon,
|
|
|
|
bio: DocsIcon,
|
|
|
|
img: ShowcaseIcon,
|
|
|
|
}
|