Add Word Wrangler demos

This commit is contained in:
Mark Backman
2025-04-24 14:29:19 -04:00
parent 09ff836ef6
commit c80d09f66c
54 changed files with 12209 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
import React, { createContext, useContext, useState, ReactNode } from 'react';
import { PersonalityType, DEFAULT_PERSONALITY } from '@/types/personality';
interface ConfigurationContextProps {
personality: PersonalityType;
setPersonality: (personality: PersonalityType) => void;
}
const ConfigurationContext = createContext<
ConfigurationContextProps | undefined
>(undefined);
interface ConfigurationProviderProps {
children: ReactNode;
}
export function ConfigurationProvider({
children,
}: ConfigurationProviderProps) {
const [personality, setPersonality] =
useState<PersonalityType>(DEFAULT_PERSONALITY);
const value = {
personality,
setPersonality,
};
return (
<ConfigurationContext.Provider value={value}>
{children}
</ConfigurationContext.Provider>
);
}
export function useConfigurationSettings() {
const context = useContext(ConfigurationContext);
if (context === undefined) {
throw new Error(
'useConfigurationSettings must be used within a ConfigurationProvider'
);
}
return context;
}