Skip to content

Commit

Permalink
fixed broken button coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Ruf committed Aug 2, 2024
1 parent 748b4ce commit bd68354
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Resources/src/components/balance/BalanceHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
>
<template #button>
<button
class="hover:bg-highlight-2 btn-highlight-shadow mx-2 mb-6 mt-4 h-9 items-center rounded-btn bg-highlight px-[34px] text-center text-btn font-bold text-white shadow-btn drop-shadow-btn transition-all duration-300 ease-out active:translate-y-0.5 active:shadow-btn-active"
class="hover:bg-highlight-2 btn-highlight-shadow mx-2 mb-6 mt-4 h-9 items-center rounded-btn bg-highlight px-[34px] text-center text-btn font-bold text-white drop-shadow-btn transition-all duration-300 ease-out active:translate-y-0.5 active:shadow-btn-active"
>
<span class="align-middle leading-[10px]">+ {{ t('balance.add') }}</span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/src/components/guest/GuestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</div>
<div class="mt-10 text-right">
<button
class="hover:bg-highlight-2 btn-highlight-shadow mx-2 mb-6 mt-4 h-9 items-center rounded-btn bg-highlight px-[34px] text-center text-btn font-bold text-white shadow-btn drop-shadow-btn transition-all duration-300 ease-out active:translate-y-0.5 active:shadow-btn-active"
class="hover:bg-highlight-2 btn-highlight-shadow mx-2 mb-6 mt-4 h-9 items-center rounded-btn bg-highlight px-[34px] text-center text-btn font-bold text-white drop-shadow-btn transition-all duration-300 ease-out active:translate-y-0.5 active:shadow-btn-active"
@click="emit('submitForm')"
>
{{ t('guest.submit') }}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/src/components/misc/CreateButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
:class="[open || pressed ? 'translate-y-0.5' : 'btn-highlight-shadow shadow-btn']"
:class="[open || pressed ? 'translate-y-0.5' : 'btn-highlight-shadow']"
class="mx-2 mb-6 mt-4 flex h-9 items-center justify-center rounded-btn bg-highlight px-[34px] text-center text-btn font-bold leading-[10px] text-white drop-shadow-btn transition-all duration-300 ease-out hover:bg-[#f7a043] focus:outline-none"
@mousedown="handleMouseDown"
@mouseup="handleMouseUp"
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/src/components/misc/SubmitButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
type="submit"
:value="btnText ?? t('slot.save')"
class="col-span-6 col-start-1 mx-auto mb-6 mt-4 flex h-9 cursor-pointer items-center rounded-btn bg-highlight px-[34px] text-btn font-bold leading-[10px] text-white drop-shadow-btn transition-all duration-300 ease-out hover:bg-[#f7a043] focus:outline-none"
:class="[isMouseDown ? 'translate-y-0.5' : 'btn-highlight-shadow shadow-btn']"
:class="[isMouseDown ? 'translate-y-0.5' : 'btn-highlight-shadow']"
@mousedown="isMouseDown = true"
@mouseup="isMouseDown = false"
/>
Expand Down
3 changes: 0 additions & 3 deletions src/Resources/tests/unit/misc/CreateButton.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test CreateButton', () => {

expect(wrapper.find('div').text()).toEqual('TestText123');
expect(wrapper.classes()).toContain('btn-highlight-shadow');
expect(wrapper.classes()).toContain('shadow-btn');
});

it('should change classes when the open prop changes', async () => {
Expand All @@ -25,13 +24,11 @@ describe('Test CreateButton', () => {
});

expect(wrapper.classes()).toContain('btn-highlight-shadow');
expect(wrapper.classes()).toContain('shadow-btn');

await wrapper.setProps({ open: true });

expect(wrapper.vm.open).toBeTruthy();
expect(wrapper.classes()).toContain('translate-y-0.5');
expect(wrapper.classes()).not.toContain('btn-highlight-shadow');
expect(wrapper.classes()).not.toContain('shadow-btn');
});
});
3 changes: 0 additions & 3 deletions src/Resources/tests/unit/misc/SubmitButton.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ describe('Test SubmitButton', () => {
const wrapper = mount(SubmitButton);

expect(wrapper.classes()).not.toContain('translate-y-0.5');
expect(wrapper.classes()).toContain('shadow-btn');
expect(wrapper.classes()).toContain('btn-highlight-shadow');

await wrapper.trigger('mousedown');

expect(wrapper.classes()).toContain('translate-y-0.5');
expect(wrapper.classes()).not.toContain('shadow-btn');
expect(wrapper.classes()).not.toContain('btn-highlight-shadow');

await wrapper.trigger('mouseup');
expect(wrapper.classes()).not.toContain('translate-y-0.5');
expect(wrapper.classes()).toContain('shadow-btn');
expect(wrapper.classes()).toContain('btn-highlight-shadow');
});
});

0 comments on commit bd68354

Please sign in to comment.