Skip to content

Commit 068307f

Browse files
committed
Colour segment selector based on category colour
1 parent 9deb69b commit 068307f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/SponsorTimeEditComponent.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
205205
);
206206
}
207207

208+
const borderColor = this.state.selectedCategory ? Config.config.barTypes[this.state.selectedCategory]?.color : null;
209+
208210
return (
209211
<div id={"sponsorTimeEditContainer" + this.idSuffix} style={style}>
210212

@@ -215,7 +217,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
215217
<select id={"sponsorTimeCategories" + this.idSuffix}
216218
className="sponsorTimeEditSelector sponsorTimeCategories"
217219
ref={this.categoryOptionRef}
218-
style={{color: "inherit", backgroundColor: "inherit"}}
220+
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
219221
value={this.state.selectedCategory}
220222
onChange={(event) => this.categorySelectionChange(event)}>
221223
{this.getCategoryOptions()}
@@ -240,7 +242,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
240242
<select id={"sponsorTimeActionTypes" + this.idSuffix}
241243
className="sponsorTimeEditSelector sponsorTimeActionTypes"
242244
value={this.state.selectedActionType}
243-
style={{color: "inherit", backgroundColor: "inherit"}}
245+
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
244246
ref={this.actionTypeOptionRef}
245247
onChange={(e) => this.actionTypeSelectionChange(e)}>
246248
{this.getActionTypeOptions(sponsorTime)}
@@ -269,7 +271,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
269271
<div onBlur={() => this.setState({chapterNameSelectorOpen: false})}>
270272
<input id={"chapterName" + this.idSuffix}
271273
className="sponsorTimeEdit sponsorTimeEditInput sponsorChapterNameInput"
272-
style={{color: "inherit", backgroundColor: "inherit"}}
274+
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
273275
ref={this.descriptionOptionRef}
274276
type="text"
275277
value={this.state.description}

0 commit comments

Comments
 (0)