import React, { useReducer, useState } from 'react'; import './App.css'; import './checkbox.css'; import './switch.css'; import './number.input.css'; export interface AppProps { onChange: (state: Omit) => void; theme?: 'dark' | 'light'; type?: 'hover' | 'spotlight'; resize?: boolean; radius?: number; color?: string | boolean; filled?: boolean; } const App: React.FC = ({ onChange, type: _type = 'hover', resize: _resize = true, color: _color, filled: _filled = false, radius: _radius = 100, theme: _theme = 'dark', }) => { const [theme, setTheme] = useState<'dark' | 'light'>(_theme); const [type, setType] = useState<'hover' | 'spotlight'>(_type); const [resize, setResize] = useState(_resize); const data = { theme, type, resize, color: _color, filled: _filled, radius: _radius, }; const [hoverFields, updateHoverFields] = useReducer( ( state: { filled?: boolean; color?: string | boolean }, action: { filled?: boolean; color?: string | boolean } ) => { const newState = { ...state }; if (action.filled !== undefined) newState.filled = action.filled; if (action.color !== undefined) newState.color = action.color; setTimeout(() => onChange({ ...data, ...newState })); return newState; }, { filled: _filled, color: _color } ); const [spotlightFields, updateSpotlightFields] = useReducer( ( state: { radius: number; color?: string | boolean }, action: { radius?: number; color?: string | boolean } ) => { const newState = { ...state }; if (action.radius !== undefined) newState.radius = action.radius; if (action.color !== undefined) newState.color = action.color; setTimeout(() => onChange({ ...data, ...newState })); return newState; }, { radius: _radius, color: _color } ); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const hoverFieldColorStyle: never = { '--color-off': hoverFields.color, '--color-on': hoverFields.color, '--color-hover': hoverFields.color, }; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const spotlightFieldColorStyle: never = { '--color-off': spotlightFields.color, '--color-on': spotlightFields.color, '--color-hover': spotlightFields.color, }; return (

hexagon-background

General
Theme: {theme}
Type: {type}
Resize:
Hexagon Hover Props
Hexagon Spotlight Props
); }; export default App;