Skip to content

Commit

Permalink
Clean up style of BSMap components
Browse files Browse the repository at this point in the history
Classes should be in their right SFC
  • Loading branch information
xingrz committed Apr 6, 2024
1 parent 485bdd1 commit 3272e90
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/components/BSMap/BSCell.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<BSSelectable v-slot="{ selectable }" :row="props.row" :offset="props.offset" :length="props.src.length">
<div :class="[selectable, $style.cell]" :title="props.src" @click="handleClick" :style="style">
<BSIcon v-for="(icon, index) in (parts?.icons || [])" :key="index" :src="icon"
<BSIcon v-for="(icon, index) in (parts?.icons || [])" :key="index" :class="$style.icon" :src="icon"
@ratio="(ratio: number) => updateRatio(index, ratio)" />
</div>
</BSSelectable>
Expand Down Expand Up @@ -66,8 +66,11 @@ function updateRatio(layer: number, newRatio: number): void {
<style lang="scss" module>
.cell {
position: relative;
cursor: pointer;
width: calc(var(--bs-map-size) * var(--bs-map-cell-ratio, 1) * 1px);
height: calc(var(--bs-map-size) * 1px);
}
.icon {
position: absolute;
}
</style>
3 changes: 0 additions & 3 deletions src/components/BSMap/BSIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ function selectTextWidth(flag: string): number | undefined {
<style lang="scss" module>
.icon,
.text {
position: absolute;
user-select: none;
width: calc(var(--bs-map-size) * var(--bs-map-icon-ratio, 1) * 1px);
height: calc(var(--bs-map-size) * 1px);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/BSMap/BSSelectable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const focused = computed(() => {
<style lang="scss" module>
.selectable {
position: relative;
user-select: none;
cursor: pointer;
&::after {
display: block;
Expand Down
2 changes: 0 additions & 2 deletions src/components/BSMap/BSText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ function handleClick(): void {

<style lang="scss" module>
.text {
user-select: none;
cursor: pointer;
margin: 0 5px;
font-family: monospace;
white-space: nowrap;
Expand Down

0 comments on commit 3272e90

Please sign in to comment.