mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
Populate tool shelf and tool options bar (#66)
This commit is contained in:
45
client/web/src/components/widgets/DropdownButton.vue
Normal file
45
client/web/src/components/widgets/DropdownButton.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<button class="dropdown-button">
|
||||
<component :is="icon" />
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.dropdown-button {
|
||||
width: 16px;
|
||||
height: 24px;
|
||||
margin: 2px 4px;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 2px;
|
||||
background: #111;
|
||||
fill: #ddd;
|
||||
|
||||
&:hover {
|
||||
background: #555;
|
||||
fill: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import DropdownArrow from "../../../assets/svg/16x24-bounds-8x16-icon/dropdown-arrow.svg";
|
||||
import VerticalEllipsis from "../../../assets/svg/16x24-bounds-8x16-icon/vertical-ellipsis.svg";
|
||||
|
||||
export enum DropdownButtonIcon {
|
||||
"DropdownArrow" = "DropdownArrow",
|
||||
"VerticalEllipsis" = "VerticalEllipsis",
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
VerticalEllipsis,
|
||||
DropdownArrow,
|
||||
},
|
||||
props: {
|
||||
icon: { type: String, default: DropdownButtonIcon.DropdownArrow },
|
||||
},
|
||||
});
|
||||
</script>
|
||||
64
client/web/src/components/widgets/IconButton.vue
Normal file
64
client/web/src/components/widgets/IconButton.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<button class="icon-button" :class="[`size-${String(size)}`, gapAfter && 'gap-after']">
|
||||
<slot></slot>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.icon-button {
|
||||
display: inline-block;
|
||||
flex: 0 0 auto;
|
||||
outline: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: none;
|
||||
font-weight: bold;
|
||||
font-size: 10px;
|
||||
border-radius: 2px;
|
||||
color: #ddd;
|
||||
fill: #ddd;
|
||||
|
||||
&:not(.gap-after) + .icon-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #555;
|
||||
color: white;
|
||||
fill: white;
|
||||
}
|
||||
|
||||
&.size-10 {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
&.size-12 {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
&.size-16 {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&.size-24 {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
size: { type: Number, required: true },
|
||||
gapAfter: { type: Boolean, default: false },
|
||||
},
|
||||
});
|
||||
</script>
|
||||
51
client/web/src/components/widgets/ItemDivider.vue
Normal file
51
client/web/src/components/widgets/ItemDivider.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="item-spacer" :class="{ horizontal: horizontal }">
|
||||
<div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.item-spacer {
|
||||
margin-left: 0;
|
||||
|
||||
& + * {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
&:not(.horizontal) {
|
||||
height: 100%;
|
||||
padding: 0 8px;
|
||||
|
||||
div {
|
||||
height: calc(100% - 8px);
|
||||
width: 1px;
|
||||
margin: 4px 0;
|
||||
background: #888;
|
||||
}
|
||||
}
|
||||
|
||||
&.horizontal {
|
||||
width: 100%;
|
||||
padding: 8px 0;
|
||||
|
||||
div {
|
||||
height: 1px;
|
||||
width: calc(100% - 8px);
|
||||
margin: 0 4px;
|
||||
background: #888;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
horizontal: { type: Boolean, default: false },
|
||||
},
|
||||
});
|
||||
</script>
|
||||
35
client/web/src/components/widgets/ShelfItem.vue
Normal file
35
client/web/src/components/widgets/ShelfItem.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="shelf-item" :class="{ active: active }">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.shelf-item {
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #428bbb;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
active: { type: Boolean, default: false },
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user