advent22/ui/src/components/rects/SVGRect.vue

38 lines
702 B
Vue
Raw Normal View History

2023-01-17 18:25:56 +00:00
<template>
2023-09-06 16:25:35 +00:00
<rect :class="focused ? 'focus' : ''" :x="rectangle.left" :y="rectangle.top" :width="rectangle.width"
:height="rectangle.height" />
2023-01-17 18:25:56 +00:00
</template>
<script lang="ts">
2023-09-06 16:25:35 +00:00
import { Options, Vue } from "vue-class-component";
2023-01-17 18:25:56 +00:00
import { Rectangle } from "./rectangles";
@Options({
props: {
2023-01-17 23:58:46 +00:00
focused: {
2023-01-17 18:25:56 +00:00
type: Boolean,
default: false,
},
rectangle: Rectangle,
},
})
2023-01-24 23:19:25 +00:00
export default class extends Vue {
2023-09-06 16:25:35 +00:00
public focused!: boolean;
public rectangle!: Rectangle;
2023-01-17 18:25:56 +00:00
}
</script>
<style lang="scss" scoped>
rect {
fill: lightgreen;
stroke: green;
fill-opacity: 0.2;
stroke-opacity: 0.9;
stroke-width: 1;
2023-01-17 23:58:46 +00:00
&.focus {
2023-01-17 18:25:56 +00:00
fill: gold;
stroke: yellow;
}
}
</style>