mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 09:46:28 +08:00
3f4537eeb5
Continue from https://github.com/discourse/discourse/pull/25673. This commit starts building the inputs pane of schema theme settings. At the moment only string fields are rendered, but more types will be added in future commits.
31 lines
614 B
Plaintext
31 lines
614 B
Plaintext
import Component from "@glimmer/component";
|
|
import { Input } from "@ember/component";
|
|
|
|
export default class SchemaThemeSettingField extends Component {
|
|
#bufferVal;
|
|
|
|
get component() {
|
|
if (this.args.type === "string") {
|
|
return Input;
|
|
}
|
|
}
|
|
|
|
get value() {
|
|
return this.#bufferVal || this.args.value;
|
|
}
|
|
|
|
set value(v) {
|
|
this.#bufferVal = v;
|
|
this.args.onValueChange(v);
|
|
}
|
|
|
|
<template>
|
|
<div class="schema-field" data-name={{@name}}>
|
|
<label>{{@name}}</label>
|
|
<div class="input">
|
|
<this.component @value={{this.value}} />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
}
|