diff --git a/src/App.tsx b/src/App.tsx index c25baef..1bae45c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,13 +1,18 @@ -import { Window } from './components/system' -import { Downloaders } from './components/layout' +import type { Component } from 'solid-js' -const Main: React.FC = () => { +import { Downloaders, TitleBar } from './components/layout' + +const Main: Component = () => { return ( - - I would like to: + <> + - - +
+ I would like to: + + +
+ ) } diff --git a/src/components/design/AnimateView/AnimateView.tsx b/src/components/design/AnimateView/AnimateView.tsx new file mode 100644 index 0000000..e4c20b0 --- /dev/null +++ b/src/components/design/AnimateView/AnimateView.tsx @@ -0,0 +1,22 @@ +import { Show } from 'solid-js' +import type { Component } from 'solid-js' +import type { MotionComponentProps, Options as MotionProps } from '@motionone/solid' +import { Motion, Presence } from '@motionone/solid' + +export interface AnimateViewProps extends MotionComponentProps { + condition: boolean + animation: MotionProps + class?: string +} + +export const AnimateView: Component = (props) => { + return ( + + + + {props.children} + + + + ) +} diff --git a/src/components/system/AnimateView/index.ts b/src/components/design/AnimateView/index.ts similarity index 100% rename from src/components/system/AnimateView/index.ts rename to src/components/design/AnimateView/index.ts diff --git a/src/components/design/Button/Button.tsx b/src/components/design/Button/Button.tsx new file mode 100644 index 0000000..f96dbdc --- /dev/null +++ b/src/components/design/Button/Button.tsx @@ -0,0 +1,18 @@ +import classNames from 'classnames' +import type { Component, ComponentProps, JSXElement } from 'solid-js' + +interface ButtonProps extends ComponentProps<'button'> { + icon: JSXElement + value: string + class?: string + handler?: () => void +} + +export const Button: Component = (props) => { + return ( + + ) +} diff --git a/src/components/layout/Button/index.ts b/src/components/design/Button/index.ts similarity index 100% rename from src/components/layout/Button/index.ts rename to src/components/design/Button/index.ts diff --git a/src/components/design/Image/Image.tsx b/src/components/design/Image/Image.tsx new file mode 100644 index 0000000..8fc45c0 --- /dev/null +++ b/src/components/design/Image/Image.tsx @@ -0,0 +1,25 @@ +import classNames from 'classnames' +import type { Component } from 'solid-js' + +interface ImageProps { + size?: number + pixelated?: boolean + src: string + class?: string + height?: number + width?: number +} + +export const Image: Component = (props) => { + return ( + + ) +} diff --git a/src/components/system/Image/index.ts b/src/components/design/Image/index.ts similarity index 100% rename from src/components/system/Image/index.ts rename to src/components/design/Image/index.ts diff --git a/src/components/design/Loader/Loader.tsx b/src/components/design/Loader/Loader.tsx index ff33d69..700d492 100644 --- a/src/components/design/Loader/Loader.tsx +++ b/src/components/design/Loader/Loader.tsx @@ -1,21 +1,21 @@ -import type { HTMLMotionProps } from 'framer-motion' +import type { Component } from 'solid-js' -import { AnimateView } from '../../system' +import { Animation } from '../../../config' +import { AnimateView } from '../AnimateView' -interface LoaderProps extends HTMLMotionProps<'main'> { +interface LoaderProps { + class?: string active: boolean } -export const Loader: React.FC = ({ active, ...rest }) => { +export const Loader: Component = (props) => { return ( + class={props.class} + condition={props.active} + animation={Animation.fadeInOut({ scale: [0, 1, 0], y: [1, 4, 1] })}> - + { - icon: JSX.Element - value: string - className?: string - handler?: () => void -} - -export const Button: React.FC = ({ icon, value, className, handler }) => { - return ( - {value} - - ) -} diff --git a/src/components/layout/Downloaders/Downloader/Downloader.tsx b/src/components/layout/Downloaders/Downloader/Downloader.tsx index 85859ce..998e11e 100644 --- a/src/components/layout/Downloaders/Downloader/Downloader.tsx +++ b/src/components/layout/Downloaders/Downloader/Downloader.tsx @@ -1,61 +1,57 @@ +import { Motion } from '@motionone/solid' import classNames from 'classnames' -import { AnimatePresence, motion } from 'framer-motion' -import { useState } from 'react' +import type { Component, JSXElement } from 'solid-js' +import { For, createSignal } from 'solid-js' -export interface IDownloaderContent { - title: string - features: string[] -} +import type { GameDataDownloader } from '../../../../config' +import { Animation } from '../../../../config' +import { AnimateView } from '../../../design' interface DownloaderProps { className?: string - children: React.ReactNode - content: IDownloaderContent + children: JSXElement + content: typeof GameDataDownloader } -export const Downloader: React.FC = ({ className, children, content }) => { - const [activeContent, setActiveContent] = useState(false) +export const Downloader: Component = (props) => { + const [activeContent, setActiveContent] = createSignal(false) - const handleActiveContent = (): void => { - return setActiveContent(!activeContent) + const handleActiveContent = (): boolean => { + return setActiveContent(!activeContent()) } return (
  • - {children} + {props.children} - - {activeContent && ( - - - {content.title} - + + + {props.content.title} + - {content.features.map((feature) => { - return ( - - {feature} - - ) - })} - - )} - + + {(feature) => { + return ( + + {feature} + + ) + }} + +
  • ) } diff --git a/src/components/layout/Downloaders/Downloaders.tsx b/src/components/layout/Downloaders/Downloaders.tsx index 4d0fccb..872e760 100644 --- a/src/components/layout/Downloaders/Downloaders.tsx +++ b/src/components/layout/Downloaders/Downloaders.tsx @@ -1,19 +1,19 @@ -import { Fragment, useState } from 'react' +import type { Component } from 'solid-js' +import { createSignal } from 'solid-js' import classNames from 'classnames' -import { Image, Popup } from '../../system' -import { Button } from '../Button' -import { GameAssetsDownloader, GameDataDownloader } from '../../../config/GameDownloader' +import type { ConvertionHandler } from '../../../types' import { handleConvertion } from '../../../tools/handleConvertion' -import { Downloader } from './Downloader' -import type { ConvertionHandler } from '../../../types/global' -import { Loader } from '../../design' +import { Animation, GameAssetsDownloader, GameDataDownloader } from '../../../config' +import { Button, Image, Loader } from '../../design' +import { Popup } from '../Popup' +import { Downloader } from './Downloader/Downloader' -export const Downloaders: React.FC = () => { - const [message, setMessage] = useState('') - const [error, setError] = useState(false) - const [popup, setPopup] = useState(false) - const [loading, setLoading] = useState(true) +export const Downloaders: Component = () => { + const [message, setMessage] = createSignal('') + const [error, setError] = createSignal(false) + const [popup, setPopup] = createSignal(false) + const [loading, setLoading] = createSignal(false) const callback: ConvertionHandler = (message, state = 'idle') => { switch (state) { @@ -43,38 +43,39 @@ export const Downloaders: React.FC = () => { return callback(`Completed in: ${seconds} seconds`, 'success') } + console.log(Animation.fadeInOut({ scale: [0, 1, 0], y: [1, 4, 1] })) + return ( - - + <> + + - {message} + {message()} - -