Compare commits
No commits in common. "907b34c496a3c8d0ac9de64389950e03c96c4882" and "793a9c24db9a5d11ffc00e3f873cd7d631eec7ba" have entirely different histories.
907b34c496
...
793a9c24db
|
@ -1,18 +1,12 @@
|
|||
import './App.css';
|
||||
import Card from './components/Card/Card';
|
||||
import Launcher from './components/Launcher/Launcher';
|
||||
import LauncherGroup from './components/LauncherGroup/LauncherGroup';
|
||||
import Activator from './components/Activator/Activator';
|
||||
|
||||
const LightThemes = () => <Card name="Light Themes">
|
||||
<LauncherGroup
|
||||
exclusive={true}
|
||||
options={[
|
||||
{ title: "Dark reds" },
|
||||
{ title: "Watery" },
|
||||
{ title: "Sunset" },
|
||||
{ title: "Darkness" },
|
||||
]}
|
||||
/>
|
||||
<Activator title="Dark reds" activated={false} />
|
||||
<Activator title="Watery" activated={false} />
|
||||
<Activator title="Sunset" activated={false} />
|
||||
<Activator title="Darkness" activated={true} />
|
||||
</Card>
|
||||
|
||||
const LightSetup = () => <div> </div>
|
||||
|
@ -24,39 +18,29 @@ interface LightProps {
|
|||
const Light = ({ name }: LightProps) => <div> <p> {name} </p> </div>
|
||||
|
||||
const Tracks = () => <Card name="Tracks">
|
||||
<LauncherGroup
|
||||
exclusive={false}
|
||||
options={[
|
||||
{ title: "City BGM" },
|
||||
{ title: "Chat on the streets" },
|
||||
{ title: "Abandoned structure" },
|
||||
{ title: "Water dripping" },
|
||||
]}
|
||||
/>
|
||||
<Track name="City BGM" />
|
||||
<Track name="Chat on the streets" />
|
||||
<Track name="Abandoned structure" />
|
||||
<Track name="Water dripping" />
|
||||
</Card>
|
||||
|
||||
interface TrackProps {
|
||||
name: string,
|
||||
}
|
||||
const Track = ({ name }: TrackProps) => <Launcher title={name} />
|
||||
const Track = ({ name }: TrackProps) => <Activator title={name} activated={false} />
|
||||
|
||||
const Presets = () => <Card name="Presets">
|
||||
<LauncherGroup
|
||||
exclusive={true}
|
||||
options={[
|
||||
{ title: "Gilcrest Falls day" },
|
||||
{ title: "Gilcrest Falls night" },
|
||||
{ title: "Empty colony" },
|
||||
{ title: "Surk colony" },
|
||||
]}
|
||||
/>
|
||||
<Scene name="Gilcrest Falls day" />
|
||||
<Scene name="Gilcrest Falls night" />
|
||||
<Scene name="Empty colony" />
|
||||
<Scene name="Surk colony" />
|
||||
</Card>
|
||||
|
||||
interface PresetProps {
|
||||
name: string
|
||||
}
|
||||
|
||||
// const Scene = ({ name }: PresetProps) => <Launcher title={name} activated={false} />
|
||||
const Scene = ({ name }: PresetProps) => <Activator title={name} activated={false} />
|
||||
|
||||
const SceneEditor = () => <div> </div>
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import './Activator.css';
|
||||
import { PropsWithChildren } from 'react';
|
||||
|
||||
interface ActivatorProps {
|
||||
title: string,
|
||||
icon?: string,
|
||||
activated: boolean,
|
||||
}
|
||||
|
||||
const Activator = ({ title, icon, activated, children }: PropsWithChildren<ActivatorProps>) => {
|
||||
const classnames = activated ? "activator activator_enabled" : "activator";
|
||||
return (
|
||||
<div className={classnames}>
|
||||
<p> {title} </p>
|
||||
</div>)
|
||||
}
|
||||
|
||||
export default Activator;
|
|
@ -11,5 +11,6 @@
|
|||
}
|
||||
|
||||
.card__body {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
import './Launcher.css';
|
||||
import React from 'react';
|
||||
|
||||
export interface LauncherProps {
|
||||
title: string,
|
||||
icon?: string,
|
||||
activated?: boolean,
|
||||
onSelected?: (key: string) => void,
|
||||
}
|
||||
|
||||
const Launcher = ({ title, activated = false, onSelected = (key) => {} }: LauncherProps) => {
|
||||
const classnames = activated ? "activator activator_enabled" : "activator";
|
||||
console.log("classnames ", activated, classnames);
|
||||
return (
|
||||
<div className={classnames} onClick={() => onSelected(title)}>
|
||||
<p> {title} </p>
|
||||
</div>)
|
||||
}
|
||||
|
||||
export default Launcher;
|
|
@ -1,36 +0,0 @@
|
|||
import React from 'react';
|
||||
import Launcher, { LauncherProps } from '../Launcher/Launcher';
|
||||
|
||||
export interface Selectable {
|
||||
onSelected?: (key: string) => void;
|
||||
}
|
||||
|
||||
interface LauncherGroupProps {
|
||||
options: Array<LauncherProps>;
|
||||
exclusive: boolean;
|
||||
}
|
||||
|
||||
const exclusiveSelect = (state: { [key: string]: boolean }, targetId: string) => {
|
||||
console.log("running exclusiveSelect on ", targetId);
|
||||
return { [targetId]: true };
|
||||
}
|
||||
|
||||
const multiSelect = (state: { [key: string]: boolean }, targetId: string) => {
|
||||
if (state[targetId]) {
|
||||
return { ...state, [targetId]: false };
|
||||
} else {
|
||||
return { ...state, [targetId]: true };
|
||||
}
|
||||
}
|
||||
|
||||
const LauncherGroup = ({ options, exclusive }: LauncherGroupProps) => {
|
||||
const [selected, dispatch] = React.useReducer(exclusive ? exclusiveSelect : multiSelect, {});
|
||||
|
||||
let tiedOptions = options.map(option =>
|
||||
<Launcher key={option.title} title={option.title} onSelected={(key: string) => dispatch(key)} activated={selected[option.title]} />
|
||||
);
|
||||
|
||||
return (<div> {tiedOptions} </div>)
|
||||
}
|
||||
|
||||
export default LauncherGroup;
|
Loading…
Reference in New Issue