mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
SVGRect "variant" prop fitting color scheme
This commit is contained in:
parent
bc4054ef73
commit
9063ebe93a
5 changed files with 66 additions and 38 deletions
20
ui/src/bulma-vars.scss
Normal file
20
ui/src/bulma-vars.scss
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
@charset "utf-8";
|
||||||
|
|
||||||
|
//=====================
|
||||||
|
// custom color scheme
|
||||||
|
//=====================
|
||||||
|
|
||||||
|
$primary: #945DE1;
|
||||||
|
$link: #64B4BD;
|
||||||
|
$info: #8C4E80;
|
||||||
|
$success: #7E8E2B;
|
||||||
|
$warning: #F6CA6B;
|
||||||
|
$danger: #C5443B;
|
||||||
|
|
||||||
|
// Sass variables (bulma)
|
||||||
|
@import "~bulma/sass/utilities/initial-variables.sass";
|
||||||
|
@import "~bulma/sass/utilities/derived-variables.sass";
|
||||||
|
|
||||||
|
// Sass variables (bulma-prefers-dark)
|
||||||
|
@import "~bulma-prefers-dark/sass/utilities/initial-variables.sass";
|
||||||
|
@import "~bulma-prefers-dark/sass/utilities/derived-variables.sass";
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<rect
|
<rect
|
||||||
:class="color !== undefined ? `visible ${color}` : ''"
|
:class="variant !== undefined ? variant : ''"
|
||||||
:x="rectangle.left"
|
:x="rectangle.left"
|
||||||
:y="rectangle.top"
|
:y="rectangle.top"
|
||||||
:width="rectangle.width"
|
:width="rectangle.width"
|
||||||
|
@ -12,12 +12,11 @@
|
||||||
import { Rectangle } from "@/lib/rectangle";
|
import { Rectangle } from "@/lib/rectangle";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
// type RectClass = "red" | "yellow" | "green" | "blue" | "purple";
|
type RectColor = "primary" | "link" | "info" | "success" | "warning" | "danger";
|
||||||
type RectColor = "yellow" | "green";
|
|
||||||
|
|
||||||
@Options({
|
@Options({
|
||||||
props: {
|
props: {
|
||||||
color: {
|
variant: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
@ -25,29 +24,48 @@ type RectColor = "yellow" | "green";
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public color?: RectColor;
|
public variant?: RectColor;
|
||||||
public rectangle!: Rectangle;
|
public rectangle!: Rectangle;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@import "@/bulma-vars";
|
||||||
|
|
||||||
rect {
|
rect {
|
||||||
fill: transparent;
|
fill: transparent;
|
||||||
|
fill-opacity: 0.3;
|
||||||
|
stroke-opacity: 0.9;
|
||||||
|
stroke-width: 1;
|
||||||
|
|
||||||
&.visible {
|
&.primary {
|
||||||
fill-opacity: 0.2;
|
fill: $primary;
|
||||||
stroke-opacity: 0.9;
|
stroke: $primary;
|
||||||
stroke-width: 1;
|
}
|
||||||
|
|
||||||
&.yellow {
|
&.link {
|
||||||
fill: gold;
|
fill: $link;
|
||||||
stroke: yellow;
|
stroke: $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.green {
|
&.info {
|
||||||
fill: lightgreen;
|
fill: $info;
|
||||||
stroke: green;
|
stroke: $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
fill: $success;
|
||||||
|
stroke: $success;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.warning {
|
||||||
|
fill: $warning;
|
||||||
|
stroke: $warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.danger {
|
||||||
|
fill: $danger;
|
||||||
|
stroke: $danger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<SVGRect :rectangle="door.position" :color="editing ? 'yellow' : 'green'" />
|
<SVGRect
|
||||||
|
:rectangle="door.position"
|
||||||
|
:variant="editing ? 'success' : 'primary'"
|
||||||
|
/>
|
||||||
<foreignObject
|
<foreignObject
|
||||||
:x="Math.round(parent_aspect_ratio * door.position.left)"
|
:x="Math.round(parent_aspect_ratio * door.position.left)"
|
||||||
:y="door.position.top"
|
:y="door.position.top"
|
||||||
|
|
|
@ -10,11 +10,15 @@
|
||||||
>
|
>
|
||||||
<SVGRect
|
<SVGRect
|
||||||
v-for="(rect, index) in rectangles"
|
v-for="(rect, index) in rectangles"
|
||||||
color="green"
|
variant="primary"
|
||||||
:key="`rect-${index}`"
|
:key="`rect-${index}`"
|
||||||
:rectangle="rect"
|
:rectangle="rect"
|
||||||
/>
|
/>
|
||||||
<SVGRect v-if="preview_visible" color="yellow" :rectangle="preview_rect" />
|
<SVGRect
|
||||||
|
v-if="preview_visible"
|
||||||
|
variant="success"
|
||||||
|
:rectangle="preview_rect"
|
||||||
|
/>
|
||||||
</ThouCanvas>
|
</ThouCanvas>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
//=====================
|
@import "@/bulma-vars";
|
||||||
// custom color scheme
|
|
||||||
//=====================
|
|
||||||
|
|
||||||
$primary: #945DE1;
|
|
||||||
$link: #64B4BD;
|
|
||||||
$info: #8C4E80;
|
|
||||||
$success: #7E8E2B;
|
|
||||||
$warning: #F6CA6B;
|
|
||||||
$danger: #C5443B;
|
|
||||||
|
|
||||||
// Sass variables (bulma)
|
|
||||||
@import "~bulma/sass/utilities/initial-variables";
|
|
||||||
@import "~bulma/sass/utilities/derived-variables";
|
|
||||||
|
|
||||||
// Sass variables (bulma-prefers-dark)
|
|
||||||
@import "~bulma-prefers-dark/sass/utilities/initial-variables";
|
|
||||||
@import "~bulma-prefers-dark/sass/utilities/derived-variables";
|
|
||||||
|
|
||||||
//=================
|
//=================
|
||||||
// variable tweaks
|
// variable tweaks
|
||||||
|
|
Loading…
Reference in a new issue