mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 19:01:52 +08:00
8bec0ca083
Continue from https://github.com/discourse/discourse/pull/25673 and https://github.com/discourse/discourse/pull/25811. This commit adds support for boolean, integer and enum types for schema theme settings.
36 lines
885 B
Plaintext
36 lines
885 B
Plaintext
import Component from "@glimmer/component";
|
|
import BooleanField from "./types/boolean";
|
|
import EnumField from "./types/enum";
|
|
import IntegerField from "./types/integer";
|
|
import StringField from "./types/string";
|
|
|
|
export default class SchemaThemeSettingField extends Component {
|
|
get component() {
|
|
switch (this.args.spec.type) {
|
|
case "string":
|
|
return StringField;
|
|
case "integer":
|
|
return IntegerField;
|
|
case "boolean":
|
|
return BooleanField;
|
|
case "enum":
|
|
return EnumField;
|
|
default:
|
|
throw new Error("unknown type");
|
|
}
|
|
}
|
|
|
|
<template>
|
|
<div class="schema-field" data-name={{@name}}>
|
|
<label>{{@name}}</label>
|
|
<div class="input">
|
|
<this.component
|
|
@value={{@value}}
|
|
@spec={{@spec}}
|
|
@onChange={{@onValueChange}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
}
|