Skip to content

Commit

Permalink
style: Fix button style
Browse files Browse the repository at this point in the history
  • Loading branch information
spider-hand committed Mar 17, 2024
1 parent 810a8df commit 5dfc737
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
39 changes: 6 additions & 33 deletions src/components/shared/IconButtonComponent.vue
Original file line number Diff line number Diff line change
@@ -1,51 +1,32 @@
<template>
<div :class="[$style['icon-button'], $style[`icon-button--${size}`]]">
<button :class="$style['icon-button']">
<img
:src="getIconUrl(icon)"
:width="iconSize"
:height="iconSize"
:width="24"
:height="24"
:alt="`${icon} icon`"
:class="$style['icon-button__icon']"
>
</div>
</button>
</template>

<script setup lang="ts">
import { PropType, computed } from "vue";
import { getIconUrl } from "@/utils";
type IconSizeTypes = "sm" | "md";
const props = defineProps({
size: {
type: String as PropType<IconSizeTypes>,
required: false,
default: "md",
},
defineProps({
icon: {
type: String,
required: true,
},
});
const iconSize = computed(() => {
switch (props.size) {
case "sm":
return "16";
case "md":
return "24";
default: {
return "24";
}
}
});
</script>

<style module lang="scss">
.icon-button {
display: flex;
align-items: center;
justify-content: center;
padding: 12px;
background: var(--color-brand-gradient);
border: none;
border-radius: 100px;
Expand All @@ -54,13 +35,5 @@ const iconSize = computed(() => {
&:active {
transform: scale(0.95);
}
&--sm {
padding: 4px;
}
&--md {
padding: 12px;
}
}
</style>
4 changes: 2 additions & 2 deletions src/views/GameView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
v-if="deviceState <= DEVICE_TYPES.MOBLE_PORTRAIT"
v-show="inGameState.isMapVisible && !inGameState.isShowingResult"
:icon="'close'"
:size="'sm'"
:style="{
zIndex: '3',
position: 'absolute',
bottom: '280px',
bottom: '272px',
left: '20px',
padding: '4px',
}"
@click="inGameState.isMapVisible = false"
/>
Expand Down

0 comments on commit 5dfc737

Please sign in to comment.