Skip to content

Commit

Permalink
draft of roulette settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
stCarolas committed Feb 11, 2024
1 parent cab09ec commit b72c352
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 19 deletions.
5 changes: 2 additions & 3 deletions src/components/ConfigurationPage/css/WidgetButton.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
/* CSS */
.widget-button {
border: 1px solid #151a33;
margin-left: 10px;
background-color: #151a33;
color: #6b7bbc;
color: #7885bd;
border-radius: 4px;
box-shadow: rgba(0, 0, 0, 0.1) 0 2px 4px 0;
box-sizing: border-box;
color: #fff;
cursor: pointer;
font-family:
"Akzidenz Grotesk BQ Medium",
Expand Down Expand Up @@ -66,4 +64,5 @@
border: 1px solid red;
background: #e62143;
color: white;
margin-left: 10px;
}
20 changes: 12 additions & 8 deletions src/pages/Reel/RouletteWidgetSettings.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
align-items: end;
}

.addoptionsbutton {
border: none;
background-color: initial;
color: #684aff;
}

.addbuttoncontainer {
width: 50%;
width: 60%;
text-align: center;
padding-top: 10px;
padding-top: 20px;
}

.option {
width: 60%;
display: flex;
align-items: center;
}

.option .widget-settings-value {
width: unset;
}
46 changes: 38 additions & 8 deletions src/pages/Reel/RouletteWidgetSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ export default function RouletteWidgetSettings({
});
}, [config]);

function updateOption(index: number, value: string) {
const updated = optionList.toSpliced(index, 1, value);
update("optionList", updated);
}

function removeOption(index: number) {
const updated = optionList.toSpliced(index, 1);
update("optionList", updated);
}

return (
<>
<BaseSettings id={id} onChange={onChange} />
Expand All @@ -46,16 +56,36 @@ export default function RouletteWidgetSettings({
<div className={classes.optionscontainer}>
{optionList &&
optionList.map((option, number) => (
<textarea
key={number}
value={option}
className="widget-settings-value"
/>
<>
<div className={classes.option}>
<textarea
key={number}
value={option}
className="widget-settings-value"
style={{ width: "100%" }}
onChange={(e) => updateOption(number, e.target.value)}
/>
<button className="widget-button" onClick={() => {
removeOption(number);
}}>
<span className="material-symbols-sharp">delete</span>
</button>
</div>
</>
))}
<div className={classes.addbuttoncontainer}>
<button className={classes.addoptionsbutton}>
<span className="material-symbols-sharp">add</span>
</button>
<button
className="widget-button"
style={{ width: "100%" }}
onClick={() => {
setOptionList((oldList) => {
oldList.push("");
return structuredClone(oldList);
});
}}
>
Добавить
</button>
</div>
</div>
</div>
Expand Down

0 comments on commit b72c352

Please sign in to comment.