Responsive button layout via ButtonGroup
This commit is contained in:
parent
33f076b1b6
commit
e80b6b2028
|
@ -29,8 +29,6 @@ function onClick() {
|
||||||
@import "../../scss/variables";
|
@import "../../scss/variables";
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin: 0.3em;
|
|
||||||
|
|
||||||
padding: $button-padding;
|
padding: $button-padding;
|
||||||
border-radius: $button-border-radius;
|
border-radius: $button-border-radius;
|
||||||
border-width: $button-border-width;
|
border-width: $button-border-width;
|
||||||
|
|
50
frontend/src/components/form/ButtonGroup.vue
Normal file
50
frontend/src/components/form/ButtonGroup.vue
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type {ButtonSize} from "@/types";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
buttonSize: ButtonSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div :class="['button-group', buttonSize]">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "../../scss/variables";
|
||||||
|
@import "../../scss/mixins";
|
||||||
|
|
||||||
|
.button-group {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: $button-margin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include max-page-breakpoint(smaller) {
|
||||||
|
.button-group {
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: $button-margin 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@include page-breakpoint(smaller) {
|
||||||
|
.button-group {
|
||||||
|
align-items: center;
|
||||||
|
button {
|
||||||
|
flex-grow: 1;
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -15,3 +15,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin min-page-breakpoint($name) {
|
||||||
|
$breakpoint: map-get($page-breakpoints, $name);
|
||||||
|
$lower-bound: nth($breakpoint, 1);
|
||||||
|
@media ($lower-bound <= width) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin max-page-breakpoint($name) {
|
||||||
|
$breakpoint: map-get($page-breakpoints, $name);
|
||||||
|
$upper-bound: nth($breakpoint, 2);
|
||||||
|
@if ($upper-bound == null) {
|
||||||
|
@error "Breakpoint #{$name} has no upper bound.";
|
||||||
|
}
|
||||||
|
@else {
|
||||||
|
@media (width < $upper-bound) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,20 +33,22 @@ $variant-color-info: map-get($variant-colors, info);
|
||||||
// Page
|
// Page
|
||||||
$page-breakpoints: (
|
$page-breakpoints: (
|
||||||
// first value is <=, second <
|
// first value is <=, second <
|
||||||
xs: (0px, 576px),
|
smallest: (0px, 375px),
|
||||||
sm: (576px, 768px),
|
smaller: (375px, 576px),
|
||||||
md: (768px, 992px),
|
small: (576px, 768px),
|
||||||
lg: (992px, 1200px),
|
medium: (768px, 992px),
|
||||||
xl: (1200px, 1400px),
|
large: (992px, 1200px),
|
||||||
xxl: (1400px, null),
|
larger: (1200px, 1400px),
|
||||||
|
largest: (1400px, null),
|
||||||
);
|
);
|
||||||
$page-container-widths: (
|
$page-container-widths: (
|
||||||
xs: 100%,
|
smallest: 100%,
|
||||||
sm: 100%,
|
smaller: 100%,
|
||||||
md: 768px,
|
small: 100%,
|
||||||
lg: 992px,
|
medium: 768px,
|
||||||
xl: 992px,
|
large: 992px,
|
||||||
xxl: 992px,
|
larger: 992px,
|
||||||
|
largest: 992px,
|
||||||
);
|
);
|
||||||
$page-background-color: $gray-darkest;
|
$page-background-color: $gray-darkest;
|
||||||
$page-text-color: $gray-lighter;
|
$page-text-color: $gray-lighter;
|
||||||
|
@ -90,12 +92,13 @@ $nav-footer-padding: 0.75em;
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
$statistics-card-widths: (
|
$statistics-card-widths: (
|
||||||
xs: 100%,
|
smallest: 100%,
|
||||||
sm: 50%,
|
smaller: 80%,
|
||||||
md: 50%,
|
small: 50%,
|
||||||
lg: 33.3333%,
|
medium: 50%,
|
||||||
xl: 33.3333%,
|
large: 33.3333%,
|
||||||
xxl: 33.3333%,
|
larger: 33.3333%,
|
||||||
|
largest: 33.3333%,
|
||||||
);
|
);
|
||||||
$statistics-card-height: 4.5em;
|
$statistics-card-height: 4.5em;
|
||||||
$statistics-card-margin: 0.5em;
|
$statistics-card-margin: 0.5em;
|
||||||
|
|
|
@ -67,6 +67,7 @@ refresh();
|
||||||
|
|
||||||
.statistics {
|
.statistics {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@each $breakpoint, $width in $statistics-card-widths {
|
@each $breakpoint, $width in $statistics-card-widths {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ActionButton from "@/components/form/ActionButton.vue";
|
import ActionButton from "@/components/form/ActionButton.vue";
|
||||||
|
import ButtonGroup from "@/components/form/ButtonGroup.vue";
|
||||||
import PageContainer from "@/components/page/PageContainer.vue";
|
import PageContainer from "@/components/page/PageContainer.vue";
|
||||||
import {ButtonSize, ComponentVariant} from "@/types";
|
import {ButtonSize, ComponentVariant} from "@/types";</script>
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
|
@ -12,7 +12,7 @@ import {ButtonSize, ComponentVariant} from "@/types";
|
||||||
Knoten in Betrieb und möchtest seine Daten ändern? Oder Du möchtest einen Knoten, der nicht mehr in Betrieb
|
Knoten in Betrieb und möchtest seine Daten ändern? Oder Du möchtest einen Knoten, der nicht mehr in Betrieb
|
||||||
ist löschen? Dann bist Du hier richtig!</p>
|
ist löschen? Dann bist Du hier richtig!</p>
|
||||||
|
|
||||||
<div class="actions">
|
<ButtonGroup :button-size="ButtonSize.LARGE">
|
||||||
<ActionButton
|
<ActionButton
|
||||||
:variant="ComponentVariant.INFO"
|
:variant="ComponentVariant.INFO"
|
||||||
:size="ButtonSize.LARGE"
|
:size="ButtonSize.LARGE"
|
||||||
|
@ -31,9 +31,13 @@ import {ButtonSize, ComponentVariant} from "@/types";
|
||||||
icon="trash">
|
icon="trash">
|
||||||
Knoten löschen
|
Knoten löschen
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</ButtonGroup>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@import "../scss/variables";
|
||||||
|
@import "../scss/mixins";
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue