From 1b5c7b53d914adfc0c5e742ac8db93e5c7e837cd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 30 Aug 2024 20:01:19 +0200 Subject: [PATCH] feat: Refactor `NcButton` 1. Make it a template component instead of a render function 2. Add a `text` prop to allow passing text content as prop 3. Add `noIconAriaHidden` to allow making the icon appear on the accessible tree Signed-off-by: Ferdinand Thiessen --- src/components/NcButton/NcButton.vue | 642 ++---------------- .../NcButton/NcButtonImplementation.vue | 404 +++++++++++ src/components/NcButton/NcButtonWrapper.vue | 9 + src/components/NcButton/types.ts | 164 +++++ styleguide.config.cjs | 1 + 5 files changed, 646 insertions(+), 574 deletions(-) create mode 100644 src/components/NcButton/NcButtonImplementation.vue create mode 100644 src/components/NcButton/NcButtonWrapper.vue diff --git a/src/components/NcButton/NcButton.vue b/src/components/NcButton/NcButton.vue index fb59dc5543..2b98b50849 100644 --- a/src/components/NcButton/NcButton.vue +++ b/src/components/NcButton/NcButton.vue @@ -37,44 +37,44 @@ It can be used with one or multiple actions. aria-label="Example text" :disabled="disabled" :size="size" + :text="text" type="tertiary-no-background"> - - + :size="size" + :text="text"> - - @@ -83,13 +83,13 @@ It can be used with one or multiple actions. - Example text @@ -102,32 +102,32 @@ It can be used with one or multiple actions. - Example text - Example text - Example text

-

@@ -148,7 +148,14 @@ export default { size: 'normal', style: 'icontext', } - } + }, + computed: { + text() { + if (this.style.includes('text')) { + return 'Example text' + } + }, + }, } @@ -189,45 +196,39 @@ Sometimes it is required to change the icon alignment on the button, like for sw ```vue - + - Favorite