Skip to content

Commit

Permalink
chore: refactor music table render
Browse files Browse the repository at this point in the history
  • Loading branch information
Discreater committed Nov 9, 2023
1 parent ccb61ef commit 0f013aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/Navigator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const inTauri = getPlatform() === 'tauri';
@keyup.enter="search"
>
<template #extra>
<QHoverButton size="small" :disabled="!searchText" @click="search">
<QHoverButton size="custom" :disabled="!searchText" @click="search">
<IconSearch clip="text-xs" />
</QHoverButton>
</template>
Expand All @@ -120,7 +120,7 @@ const inTauri = getPlatform() === 'tauri';
:placeholder="t('nav.search')" @keyup.enter="search"
>
<template #extra>
<QHoverButton size="small" :disabled="!searchText" @click="search">
<QHoverButton size="custom" :disabled="!searchText" @click="search">
<IconSearch text="text-xs" />
</QHoverButton>
</template>
Expand Down
6 changes: 3 additions & 3 deletions src/components/QHoverButton.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup lang="ts">
type Size = 'small' | 'normal';
type Size = 'custom' | 'fixed';
type Cursor = 'default' | 'pointer';
const props = withDefaults(defineProps<{ disabled?: boolean; size?: Size; cursor?: Cursor }>(), {
disabled: false,
size: 'normal',
size: 'fixed',
cursor: 'default',
});
const buttonClass = props.size === 'small' ? 'my-0.5' : 'h-10 w-10';
const buttonClass = props.size === 'custom' ? 'my-0.5' : 'h-10 w-10';
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/QInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function clear() {
@focusout="focus = false"
@input="onValueChange($event)"
>
<QHoverButton v-if="showValue" size="small" @click="clear()">
<QHoverButton v-if="showValue" size="custom" @click="clear()">
<IconDismiss class="text-xs" />
</QHoverButton>
<slot name="extra" />
Expand Down
10 changes: 6 additions & 4 deletions src/pages/main/MusicLib.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ function handleTitleClick(track: Track) {
<template #bodyCell="{ column, row, rowIdx }">
<template v-if="column.key === 'actions'">
<div class="flex">
<QButton class="text-passion" @click="playByIdx(rowIdx)">
<IconPlay />
</QButton>
<QHoverButton size="custom" class="text-passion h-8 w-8" @click="playByIdx(rowIdx)">
<IconPlay class="text-base" />
</QHoverButton>
</div>
</template>
<template v-else-if="column.key === 'title'">
<QHoverButton :text="row.title" class="hover:text-passion text-left" @click="handleTitleClick(row)" />
<QHoverButton size="custom" class="hover:text-passion text-left" @click="handleTitleClick(row)">
{{ row.title }}
</QHoverButton>
</template>
<template v-else-if="column.key === 'artist'">
<div>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/main/PlayQueue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ const columns: Column[] = [
<QTable :columns="columns" :data="views">
<template #bodyCell="{ column, row, rowIdx }">
<template v-if="column.key === 'actions'">
<QHoverButton :icon="IconPlay" class="text-passion" @click="playByIdx(rowIdx)" />
<QHoverButton size="custom" class="text-passion h-8 w-8" @click="playByIdx(rowIdx)">
<IconPlay class="text-base" />
</QHoverButton>
</template>
<template v-else-if="column.key === 'title'">
{{ row.title }}
Expand Down

0 comments on commit 0f013aa

Please sign in to comment.