From e1c56c201e2469313e8abd39459a2d903e3a669a Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 27 May 2021 18:18:26 +0100 Subject: [PATCH] Use radio buttons for server list --- src/components/sidebar/ServerList.vue | 6 +- src/components/sidebar/ServerListItem.vue | 16 ++--- src/components/util/RadioList.vue | 71 +++++++++++++++++++++++ src/scss/_mixins.scss | 1 + src/scss/style.scss | 43 +++++++++++--- 5 files changed, 116 insertions(+), 21 deletions(-) create mode 100644 src/components/util/RadioList.vue diff --git a/src/components/sidebar/ServerList.vue b/src/components/sidebar/ServerList.vue index efdddf3..bc33090 100644 --- a/src/components/sidebar/ServerList.vue +++ b/src/components/sidebar/ServerList.vue @@ -18,9 +18,9 @@ @@ -30,10 +30,12 @@ import ServerListItem from './ServerListItem.vue'; import {defineComponent} from 'vue'; import {useStore} from "@/store"; import CollapsibleSection from "@/components/sidebar/CollapsibleSection.vue"; +import RadioList from "@/components/util/RadioList.vue"; export default defineComponent({ name: 'ServerList', components: { + RadioList, CollapsibleSection, ServerListItem }, diff --git a/src/components/sidebar/ServerListItem.vue b/src/components/sidebar/ServerListItem.vue index 0b87850..8557ab6 100644 --- a/src/components/sidebar/ServerListItem.vue +++ b/src/components/sidebar/ServerListItem.vue @@ -15,12 +15,9 @@ --> + + + diff --git a/src/scss/_mixins.scss b/src/scss/_mixins.scss index 85b371a..3b8bd68 100644 --- a/src/scss/_mixins.scss +++ b/src/scss/_mixins.scss @@ -26,6 +26,7 @@ font-size: 1.6rem; font-family: Raleway, sans-serif; box-sizing: border-box; + text-shadow: none; .svg-icon { display: inline-block; diff --git a/src/scss/style.scss b/src/scss/style.scss index aad3443..958ccac 100644 --- a/src/scss/style.scss +++ b/src/scss/style.scss @@ -172,20 +172,47 @@ input { display: flex; padding: 0.8rem 0.8rem 0.7rem; position: relative; - border-bottom: 0.1rem solid transparent; > button { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; margin: -0.8rem -0.8rem -0.7rem; - padding: 0.8rem 0.8rem 0.7rem; - text-align: left; flex-grow: 1; - min-height: 3.2rem; - border-radius: 0.5rem; } } + + > input[type=radio] { + clip: rect(1px, 1px, 1px, 1px); + height: 1px; + width: 1px; + position: absolute; + + & + label { + @include button; + } + + &:hover + label, &:checked + label { + @include button-hovered; + position: relative; + } + + &:focus + label { + @include button-focused; + } + + &:active + label { + @include button-active; + } + } + + & > li > button, & > input[type=radio] + label { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + padding: 0.8rem 0.8rem 0.7rem; + text-align: left; + min-height: 3.2rem; + border-radius: 0.5rem; + border-bottom: 0.1rem solid transparent; + } } #app .map .tile img, img {