diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-05-02 09:07:57 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-05-02 09:07:57 +0900 |
| commit | 1631e62739d0c5e787de4a8e8d5ea948d3ce0745 (patch) | |
| tree | a50fe526d7039d38cb91edd1b6c9884de9e7d1de /packages | |
| parent | Update about-misskey.vue (diff) | |
| download | misskey-1631e62739d0c5e787de4a8e8d5ea948d3ce0745.tar.gz misskey-1631e62739d0c5e787de4a8e8d5ea948d3ce0745.tar.bz2 misskey-1631e62739d0c5e787de4a8e8d5ea948d3ce0745.zip | |
refactor(frontend): use css modules
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/frontend/src/components/MkInput.vue | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/packages/frontend/src/components/MkInput.vue b/packages/frontend/src/components/MkInput.vue index 3e3d7354c1..fdd8508d72 100644 --- a/packages/frontend/src/components/MkInput.vue +++ b/packages/frontend/src/components/MkInput.vue @@ -1,12 +1,13 @@ <template> -<div class="matxzzsk"> - <div class="label" @click="focus"><slot name="label"></slot></div> - <div class="input" :class="{ inline, disabled, focused }"> - <div ref="prefixEl" class="prefix"><slot name="prefix"></slot></div> +<div> + <div :class="$style.label" @click="focus"><slot name="label"></slot></div> + <div :class="$style.input" :class="{ inline, disabled, focused }"> + <div ref="prefixEl" :class="$style.prefix"><div :class="$style.prefixOrSuffixText"><slot name="prefix"></slot></div></div> <input ref="inputEl" v-model="v" v-adaptive-border + :class="$style.inputCore" :type="type" :disabled="disabled" :required="required" @@ -25,11 +26,11 @@ <datalist v-if="datalist" :id="id"> <option v-for="data in datalist" :key="data" :value="data"/> </datalist> - <div ref="suffixEl" class="suffix"><slot name="suffix"></slot></div> + <div ref="suffixEl" :class="$style.suffix"><div :class="$style.prefixOrSuffixText"><slot name="suffix"></slot></div></div> </div> - <div class="caption"><slot name="caption"></slot></div> + <div :class="$style.caption"><slot name="caption"></slot></div> - <MkButton v-if="manualSave && changed" primary class="save" @click="updated"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> + <MkButton v-if="manualSave && changed" primary :class="$style.save" @click="updated"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> </div> </template> @@ -151,115 +152,114 @@ onMounted(() => { }); </script> -<style lang="scss" scoped> -.matxzzsk { - > .label { - font-size: 0.85em; - padding: 0 0 8px 0; - user-select: none; +<style lang="scss" module> +.label { + font-size: 0.85em; + padding: 0 0 8px 0; + user-select: none; - &:empty { - display: none; - } + &:empty { + display: none; } +} - > .caption { - font-size: 0.85em; - padding: 8px 0 0 0; - color: var(--fgTransparentWeak); +.caption { + font-size: 0.85em; + padding: 8px 0 0 0; + color: var(--fgTransparentWeak); - &:empty { - display: none; - } + &:empty { + display: none; } +} - > .input { - position: relative; +.input { + position: relative; - > input { - appearance: none; - -webkit-appearance: none; - display: block; - height: v-bind("height + 'px'"); - width: 100%; - margin: 0; - padding: 0 12px; - font: inherit; - font-weight: normal; - font-size: 1em; - color: var(--fg); - background: var(--panel); - border: solid 1px var(--panel); - border-radius: 6px; - outline: none; - box-shadow: none; - box-sizing: border-box; - transition: border-color 0.1s ease-out; + &.inline { + display: inline-block; + margin: 0; + } - &:hover { - border-color: var(--inputBorderHover) !important; - } + &.focused { + > .inputCore { + border-color: var(--accent) !important; + //box-shadow: 0 0 0 4px var(--focus); } + } - > .prefix, - > .suffix { - display: flex; - align-items: center; - position: absolute; - z-index: 1; - top: 0; - padding: 0 12px; - font-size: 1em; - height: v-bind("height + 'px'"); - pointer-events: none; - - &:empty { - display: none; - } + &.disabled { + opacity: 0.7; - > * { - display: inline-block; - min-width: 16px; - max-width: 150px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } + &, + > .inputCore { + cursor: not-allowed !important; } + } +} - > .prefix { - left: 0; - padding-right: 6px; - } +.inputCore { + appearance: none; + -webkit-appearance: none; + display: block; + height: v-bind("height + 'px'"); + width: 100%; + margin: 0; + padding: 0 12px; + font: inherit; + font-weight: normal; + font-size: 1em; + color: var(--fg); + background: var(--panel); + border: solid 1px var(--panel); + border-radius: 6px; + outline: none; + box-shadow: none; + box-sizing: border-box; + transition: border-color 0.1s ease-out; - > .suffix { - right: 0; - padding-left: 6px; - } + &:hover { + border-color: var(--inputBorderHover) !important; + } +} - &.inline { - display: inline-block; - margin: 0; - } +.prefix, +.suffix { + display: flex; + align-items: center; + position: absolute; + z-index: 1; + top: 0; + padding: 0 12px; + font-size: 1em; + height: v-bind("height + 'px'"); + pointer-events: none; - &.focused { - > input { - border-color: var(--accent) !important; - //box-shadow: 0 0 0 4px var(--focus); - } - } + &:empty { + display: none; + } +} + +.prefix { + left: 0; + padding-right: 6px; +} - &.disabled { - opacity: 0.7; +.suffix { + right: 0; + padding-left: 6px; +} - &, * { - cursor: not-allowed !important; - } - } - } +.prefixOrSuffixText { + display: inline-block; + min-width: 16px; + max-width: 150px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} - > .save { - margin: 8px 0 0 0; - } +.save { + margin: 8px 0 0 0; } </style> |