discourse/app/assets/javascripts/admin/addon/components/schema-theme-setting/field.gjs
Osama Sayegh 3f4537eeb5
FEATURE: Schema theme setting input fields (#25811)
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.
2024-02-27 01:07:32 +03:00

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>
}