| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <script setup lang="ts">
- type Game = {
- name: string
- icon: string
- }
- interface Props {
- game: Game
- }
- const props = defineProps<Props>()
- const emit = defineEmits<{
- click: [game: Game]
- }>()
- const handleClick = () => {
- emit('click', props.game)
- }
- </script>
- <template>
- <button
- class="game-card"
- @click="handleClick"
- >
- <div class="game-icon">
- <img
- :src="game.icon"
- :alt="game.name"
- >
- </div>
- <span class="game-name truncate">{{ game.name }}</span>
- </button>
- </template>
- <style lang="scss" scoped>
- .game-card {
- @include size(75px, 61px);
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- cursor: pointer;
- }
- .game-icon {
- @include size(45px);
- border-radius: 50%;
- overflow: hidden;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- }
- .game-name {
- font-size: 11px;
- font-weight: 400;
- color: #1B1919;
- text-align: center;
- line-height: 14px;
- max-width: 100%;
- }
- </style>
|