import React, {useContext, useEffect} from "react";
import {Page} from "../primitives/Layout";
import DataContext from "../contexts/DataContext";
import {IconElement} from "../primitives/Elements";
import DialogContext from "../contexts/DialogContext";
import {DialogType} from "../models/Dialog";

const SettingsPage: React.FC = () => {
  const {setDialog} = useContext(DialogContext);
  const {colorPresets} = useContext(DataContext);

  useEffect(() => {
  }, []);

  return (
    <Page title="Oppsett">
      <h1>Definerte farger</h1>
      {colorPresets.map(cp => (
        <IconElement key={cp.id} color={cp.value} caption={cp.name}/>
      ))}
      <button onClick={() => setDialog({type: DialogType.AddColor})}>Add</button>
    </Page>
  );
};

export default SettingsPage;
