summaryrefslogtreecommitdiff
path: root/src/client/components
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-04-11 21:09:35 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-04-11 21:09:35 +0900
commita88e486468b53145d7745411db02fe507ddffb78 (patch)
tree08d4726422ef4d30ccb67f3f8b5275e00f800707 /src/client/components
parentResolve #7425 (diff)
downloadsharkey-a88e486468b53145d7745411db02fe507ddffb78.tar.gz
sharkey-a88e486468b53145d7745411db02fe507ddffb78.tar.bz2
sharkey-a88e486468b53145d7745411db02fe507ddffb78.zip
Tweak UI
Diffstat (limited to 'src/client/components')
-rw-r--r--src/client/components/form/base.vue8
-rw-r--r--src/client/components/form/form.scss12
-rw-r--r--src/client/components/global/a.vue6
-rw-r--r--src/client/components/modal-page-window.vue211
-rw-r--r--src/client/components/ui/modal-window.vue7
5 files changed, 239 insertions, 5 deletions
diff --git a/src/client/components/form/base.vue b/src/client/components/form/base.vue
index 249b49c675..b2e429d6bf 100644
--- a/src/client/components/form/base.vue
+++ b/src/client/components/form/base.vue
@@ -20,12 +20,16 @@ export default defineComponent({
<style lang="scss" scoped>
.rbusrurv {
+ // 他のCSSからも参照されるので消さないように
+ --formXPadding: 32px;
+ --formYPadding: 32px;
+
line-height: 1.4em;
background: var(--bg);
- padding: 32px;
+ padding: var(--formYPadding) var(--formXPadding);
&:not(.wide).max-width_400px {
- padding: 32px 0;
+ --formXPadding: 0px;
> ::v-deep(*) {
._formPanel {
diff --git a/src/client/components/form/form.scss b/src/client/components/form/form.scss
index c7f4373544..d9486430be 100644
--- a/src/client/components/form/form.scss
+++ b/src/client/components/form/form.scss
@@ -10,9 +10,17 @@
}
._formLabel {
+ position: sticky;
+ top: var(--stickyTop, 0px);
+ background: var(--bg);
+ z-index: 2;
font-size: 80%;
- padding: 0 16px 8px 16px;
- opacity: 0.8;
+ margin: -8px calc(var(--formXPadding) * -1) 0 calc(var(--formXPadding) * -1);
+ padding: 8px calc(16px + var(--formXPadding)) 8px calc(16px + var(--formXPadding));
+ color: var(--fgTransparentWeak);
+ background: var(--X17);
+ -webkit-backdrop-filter: blur(10px);
+ backdrop-filter: blur(10px);
&:empty {
display: none;
diff --git a/src/client/components/global/a.vue b/src/client/components/global/a.vue
index a8a597b2bb..7ad62a7310 100644
--- a/src/client/components/global/a.vue
+++ b/src/client/components/global/a.vue
@@ -93,6 +93,10 @@ export default defineComponent({
os.pageWindow(this.to);
},
+ modalWindow() {
+ os.modalPageWindow(this.to);
+ },
+
popout() {
popout(this.to);
},
@@ -111,6 +115,8 @@ export default defineComponent({
if (this.behavior) {
if (this.behavior === 'window') {
return this.window();
+ } else if (this.behavior === 'modalWindow') {
+ return this.modalWindow();
}
}
diff --git a/src/client/components/modal-page-window.vue b/src/client/components/modal-page-window.vue
new file mode 100644
index 0000000000..a9a5c0ce57
--- /dev/null
+++ b/src/client/components/modal-page-window.vue
@@ -0,0 +1,211 @@
+<template>
+<MkModal ref="modal" @click="$emit('click')" @closed="$emit('closed')">
+ <div class="hrmcaedk _popup _narrow_" :style="{ width: `${width}px`, height: (height ? `min(${height}px, 100%)` : '100%') }">
+ <div class="header">
+ <button class="_button" @click="back()" v-if="history.length > 0"><Fa :icon="faChevronLeft"/></button>
+ <button class="_button" style="pointer-events: none;" v-else><!-- マージンのバランスを取るためのダミー --></button>
+ <span class="title">
+ <XHeader :info="pageInfo" :with-back="false"/>
+ </span>
+ <button class="_button" @click="$refs.modal.close()"><Fa :icon="faTimes"/></button>
+ </div>
+ <div class="body _flat_">
+ <component :is="component" v-bind="props" :ref="changePage"/>
+ </div>
+ </div>
+</MkModal>
+</template>
+
+<script lang="ts">
+import { defineComponent } from 'vue';
+import { faExternalLinkAlt, faExpandAlt, faLink, faChevronLeft, faColumns, faTimes } from '@fortawesome/free-solid-svg-icons';
+import MkModal from '@client/components/ui/modal.vue';
+import XHeader from '@client/ui/_common_/header.vue';
+import { popout } from '@client/scripts/popout';
+import copyToClipboard from '@client/scripts/copy-to-clipboard';
+import { resolve } from '@client/router';
+import { url } from '@client/config';
+import * as symbols from '@client/symbols';
+
+export default defineComponent({
+ components: {
+ MkModal,
+ XHeader,
+ },
+
+ inject: {
+ sideViewHook: {
+ default: null
+ }
+ },
+
+ provide() {
+ return {
+ navHook: (path) => {
+ this.navigate(path);
+ }
+ };
+ },
+
+ props: {
+ initialPath: {
+ type: String,
+ required: true,
+ },
+ initialComponent: {
+ type: Object,
+ required: true,
+ },
+ initialProps: {
+ type: Object,
+ required: false,
+ default: () => {},
+ },
+ },
+
+ emits: ['closed'],
+
+ data() {
+ return {
+ width: 850,
+ height: 650,
+ pageInfo: null,
+ path: this.initialPath,
+ component: this.initialComponent,
+ props: this.initialProps,
+ history: [],
+ faChevronLeft, faTimes,
+ };
+ },
+
+ computed: {
+ url(): string {
+ return url + this.path;
+ },
+
+ contextmenu() {
+ return [{
+ type: 'label',
+ text: this.path,
+ }, {
+ icon: faExpandAlt,
+ text: this.$ts.showInPage,
+ action: this.expand
+ }, this.sideViewHook ? {
+ icon: faColumns,
+ text: this.$ts.openInSideView,
+ action: () => {
+ this.sideViewHook(this.path);
+ this.$refs.window.close();
+ }
+ } : undefined, {
+ icon: faExternalLinkAlt,
+ text: this.$ts.popout,
+ action: this.popout
+ }, null, {
+ icon: faExternalLinkAlt,
+ text: this.$ts.openInNewTab,
+ action: () => {
+ window.open(this.url, '_blank');
+ this.$refs.window.close();
+ }
+ }, {
+ icon: faLink,
+ text: this.$ts.copyLink,
+ action: () => {
+ copyToClipboard(this.url);
+ }
+ }];
+ },
+ },
+
+ methods: {
+ changePage(page) {
+ if (page == null) return;
+ if (page[symbols.PAGE_INFO]) {
+ this.pageInfo = page[symbols.PAGE_INFO];
+ }
+ },
+
+ navigate(path, record = true) {
+ if (record) this.history.push(this.path);
+ this.path = path;
+ const { component, props } = resolve(path);
+ this.component = component;
+ this.props = props;
+ },
+
+ back() {
+ this.navigate(this.history.pop(), false);
+ },
+
+ expand() {
+ this.$router.push(this.path);
+ this.$refs.window.close();
+ },
+
+ popout() {
+ popout(this.path, this.$el);
+ this.$refs.window.close();
+ },
+ },
+});
+</script>
+
+<style lang="scss" scoped>
+.hrmcaedk {
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ contain: content;
+
+ --root-margin: 24px;
+
+ @media (max-width: 500px) {
+ --root-margin: 16px;
+ }
+
+ > .header {
+ $height: 54px;
+ $height-narrow: 42px;
+ display: flex;
+ flex-shrink: 0;
+ box-shadow: 0px 1px var(--divider);
+
+ > button {
+ height: $height;
+ width: $height;
+
+ @media (max-width: 500px) {
+ height: $height-narrow;
+ width: $height-narrow;
+ }
+ }
+
+ > .title {
+ flex: 1;
+ line-height: $height;
+ padding-left: 32px;
+ font-weight: bold;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ pointer-events: none;
+
+ @media (max-width: 500px) {
+ line-height: $height-narrow;
+ padding-left: 16px;
+ }
+ }
+
+ > button + .title {
+ padding-left: 0;
+ }
+ }
+
+ > .body {
+ overflow: auto;
+ background: var(--bg);
+ }
+}
+</style>
diff --git a/src/client/components/ui/modal-window.vue b/src/client/components/ui/modal-window.vue
index ca17ae6093..90b803801d 100644
--- a/src/client/components/ui/modal-window.vue
+++ b/src/client/components/ui/modal-window.vue
@@ -1,6 +1,6 @@
<template>
<MkModal ref="modal" @click="$emit('click')" @closed="$emit('closed')">
- <div class="ebkgoccj _popup _narrow_" @keydown="onKeydown" :style="{ width: `${width}px`, height: height ? `${height}px` : null }">
+ <div class="ebkgoccj _popup _narrow_" @keydown="onKeydown" :style="{ width: `${width}px`, height: scroll ? (height ? `${height}px` : null) : (height ? `min(${height}px, 100%)` : '100%') }">
<div class="header">
<button class="_button" v-if="withOkButton" @click="$emit('close')"><Fa :icon="faTimes"/></button>
<span class="title">
@@ -61,6 +61,11 @@ export default defineComponent({
required: false,
default: true,
},
+ scroll: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
},
emits: ['click', 'close', 'closed', 'ok'],