Skip to content

Commit

Permalink
Refactor nested button links
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelWei committed Jan 23, 2025
1 parent 09790a2 commit bfaabb4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
25 changes: 19 additions & 6 deletions resources/js/components/AppBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,27 @@
<p class="m-0 whitespace-pre-wrap">
{{ message }}
</p>
<!-- TODO Refactor -->
<a v-if="link" :href="link" :target="`_${linkTarget}`">
<div>
<Button
v-if="link"
as="a"
:href="link"
:target="`_${linkTarget}`"
:link="linkStyle === 'link'"
:style="linkStyle === 'link' ? { color: color } : {}"
:class="linkStyle === 'link' ? 'p-0 underline' : ''"
:style="buttonStyle"
:class="buttonClass"
:severity="linkStyle"
:label="linkText ? linkText : link"
/>
</a>
</div>
</div>
</Message>
</template>

<script setup>
defineProps({
import { computed } from "vue";
const props = defineProps({

Check warning on line 50 in resources/js/components/AppBanner.vue

View check run for this annotation

Codecov / codecov/patch

resources/js/components/AppBanner.vue#L50

Added line #L50 was not covered by tests
background: {
type: String,
default: null,
Expand Down Expand Up @@ -88,6 +93,14 @@ defineProps({
default: null,
},
});
const buttonClass = computed(() => {
return props.linkStyle === "link" ? "p-0 underline" : "";

Check warning on line 98 in resources/js/components/AppBanner.vue

View check run for this annotation

Codecov / codecov/patch

resources/js/components/AppBanner.vue#L97-L98

Added lines #L97 - L98 were not covered by tests
});
const buttonStyle = computed(() => {
return props.linkStyle === "link" ? { color: props.color } : {};

Check warning on line 102 in resources/js/components/AppBanner.vue

View check run for this annotation

Codecov / codecov/patch

resources/js/components/AppBanner.vue#L101-L102

Added lines #L101 - L102 were not covered by tests
});
</script>
<style scoped>
.banner-message {
Expand Down
32 changes: 14 additions & 18 deletions resources/js/views/MeetingsIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,28 +198,24 @@
<Column :style="{ width: '100px' }" :header="$t('app.actions')">
<template #body="slotProps">
<div class="flex justify-between">
<!-- TODO Refactor -->
<router-link
<Button
v-tooltip="
$t('meetings.view_room', {
name: slotProps.data.room.name,
})
"
:to="{
name: 'rooms.view',
params: { id: slotProps.data.room.id },
}"
:disabled="true"
>
<Button
v-tooltip="
$t('meetings.view_room', {
name: slotProps.data.room.name,
})
"
:aria-label="
$t('meetings.view_room', {
name: slotProps.data.room.name,
})
"
icon="fa-solid fa-eye"
/>
</router-link>
as="router-link"
:aria-label="
$t('meetings.view_room', {
name: slotProps.data.room.name,
})
"
icon="fa-solid fa-eye"
/>
</div>
</template>
</Column>
Expand Down

0 comments on commit bfaabb4

Please sign in to comment.