@bothub-chat/ui
Version:
Bothub UI Components
2 lines (1 loc) • 2.3 kB
JavaScript
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useCallback as i}from"react";import"../../theme/index.js";import{ThemeSchemesSection as m}from"./section/index.js";import{ThemeSchemesStyled as a,ThemeAddButton as n}from"./styled.js";import{ThemeButton as r}from"./theme-button/index.js";import{ColorSchemeNamesArray as l}from"../../theme/types.js";import{useTheme as c}from"../../theme/hook.js";import{THEMES as s}from"../../theme/themes.js";const d=({customTitle:d,standardTitle:h,colorfulTitle:p,activeScheme:k,customColorsArray:u,customThemeIndex:C,editTooltipText:v,resetTooltipText:T,onAddTheme:x,onCustomClick:y,onClick:b,onEditCustom:f,onDeleteCustom:j})=>{const w=c(),[g,q]=o(k),A=i(e=>{q(e),null==b||b(e)},[b]),D=i(e=>{q("custom"),null==y||y(e)},[]);return e(a,{children:[e(m,{title:d,active:"custom"===g,onClick:()=>D(0),children:[null==u?void 0:u.map((e,o)=>t(r,{theme:{colors:e[w.mode],mode:w.mode},active:"custom"===g&&C===o,hasActions:!0,editTooltipText:v,resetTooltipText:T,onClick:()=>D(o),onEdit:()=>null==f?void 0:f(o),onDelete:()=>null==j?void 0:j(o)},`theme-button-custom-${o}`)),t(n,{onClick:x})]}),t(m,{title:h,active:"standard"===g,onClick:()=>A("standard"),children:t(r,{theme:s.standard[w.mode],active:"standard"===g,onClick:()=>A("standard")})}),e(m,{title:p,active:l.slice(2).includes(g),onClick:()=>A("strawberry"),children:[t(r,{theme:s.strawberry[w.mode],active:"strawberry"===g,onClick:()=>A("strawberry")}),t(r,{theme:s.rose[w.mode],active:"rose"===g,onClick:()=>A("rose")}),t(r,{theme:s.orange[w.mode],active:"orange"===g,onClick:()=>A("orange")}),t(r,{theme:s.milktea[w.mode],active:"milktea"===g,onClick:()=>A("milktea")}),t(r,{theme:s.banana[w.mode],active:"banana"===g,onClick:()=>A("banana")}),t(r,{theme:s.apple[w.mode],active:"apple"===g,onClick:()=>A("apple")}),t(r,{theme:s.swamp[w.mode],active:"swamp"===g,onClick:()=>A("swamp")}),t(r,{theme:s.aquamarine[w.mode],active:"aquamarine"===g,onClick:()=>A("aquamarine")}),t(r,{theme:s.mountain[w.mode],active:"mountain"===g,onClick:()=>A("mountain")}),t(r,{theme:s.lake[w.mode],active:"lake"===g,onClick:()=>A("lake")}),t(r,{theme:s.iris[w.mode],active:"iris"===g,onClick:()=>A("iris")}),t(r,{theme:s.peony[w.mode],active:"peony"===g,onClick:()=>A("peony")})]})]})};export{d as ThemeSchemes};