import variables from 'config/variables'; import { MdArchive, MdOutlineWhatshot } from 'react-icons/md'; import { useState } from 'react'; import { Header, Content } from '../Layout'; const STYLES = { NEW: 'new', LEGACY: 'legacy', }; const StyleSelection = () => { const widgetStyle = localStorage.getItem('widgetStyle') || STYLES.NEW; const [style, setStyle] = useState(widgetStyle); const changeStyle = (type) => { setStyle(type); localStorage.setItem('widgetStyle', type); }; const styleMapping = { [STYLES.LEGACY]: { className: style === STYLES.LEGACY ? 'toggle legacyStyle active' : 'toggle legacyStyle', icon: , text: variables.getMessage('modals.welcome.sections.style.legacy'), }, [STYLES.NEW]: { className: style === STYLES.NEW ? 'toggle newStyle active' : 'toggle newStyle', icon: , text: variables.getMessage('modals.welcome.sections.style.modern'), }, }; return (
{Object.entries(styleMapping).map(([type, { className, icon, text }]) => (
changeStyle(type)} key={type}> {icon} {text}
))}
); }; export { StyleSelection as default, StyleSelection };