Skip to content

Commit

Permalink
Use cleaner object binding for conditional CSS classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
krazkidd committed Sep 29, 2023
1 parent e3232e9 commit 6e6e8ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const menuPassThroughOptions = {
<Menu :model="navMenuItems" :pt="menuPassThroughOptions">
<template #item="{ label, item, props }">
<RouterLink :to="item.to!" v-slot="{ href, route, navigate, isActive, isExactActive }" custom>
<a :href="href" v-bind="props.action" @click="navigate($event).then(() => isSidebarVisible = false)" :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']">
<a :href="href" v-bind="props.action" @click="navigate($event).then(() => isSidebarVisible = false)" :class="{ 'router-link-active': isActive, 'router-link-exact-active': isExactActive }">
<span v-bind="props.icon" />
<span v-bind="props.label">{{ label }}</span>
</a>
Expand Down
5 changes: 4 additions & 1 deletion components/lineup/LineupSpot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ onKeyStroke("Backspace", (e) => {
@blur="focused = false"
tabindex="0"
>
<LineupDragHandle :class="`${ teamStore.isLocked ? 'collapse' : 'visible' } inline-block shrink-0 text-[1.3em] px-2`" />
<LineupDragHandle
:class="{ hidden: teamStore.isLocked }"
class="inline-block shrink-0 text-[1.3em] px-2"
/>

<LineupJerseyButton
:spot="props.spot"
Expand Down
2 changes: 1 addition & 1 deletion pages/lineup/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ useSortable(sortableContainer, spots, {

<LineupNewSpot
@add="!teamStore.isLocked && addSpot(lineup!.spots, $event)"
:class="`${ teamStore.isLocked ? 'collapse' : 'visible' }`"
:class="{ hidden: teamStore.isLocked }"
:num-players="spots.length"
/>
</div>
Expand Down
8 changes: 2 additions & 6 deletions pages/scoreboard/[[id]].vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,8 @@ const fakeTeam = {

<ScoreboardEmojiBoard
@emote="addEmote({ teamId, emote: $event, ticks: Date.now() } as Emote)"
:class="[
{
hidden: !route.params.id
},
'px-4'
]"
:class="{ hidden: !route.params.id }"
class="px-4"
/>
</div>
</template>

0 comments on commit 6e6e8ec

Please sign in to comment.