Skip to content

Commit

Permalink
refactor(rich-tooltip): update button and tooltip stories
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielduete committed Feb 13, 2025
1 parent bcadb0a commit ce387a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ const createRichTooltip = (args, buttonText = 'hover') => {
<atom-button
fill="solid"
size="large"
id="${args.element}"
aria-describedby="atom-tooltip"
id="${buttonText}"
aria-describedby="atom-rich-tooltip"
>
${buttonText}
</atom-button>
<atom-rich-tooltip
id="atom-tooltip"
id="atom-rich-tooltip"
placement="${args.placement}"
element="${args.element}"
element="${buttonText}"
title="${args.title}"
action="${args.action}"
action-text="${args.actionText}"
Expand All @@ -42,7 +42,6 @@ export const Hover: StoryObj = {
render: (args) => createRichTooltip(args, 'Hover'),
args: {
...RichTooltipComponentArgs,
element: 'hover',
placement: 'top',
open: false,
},
Expand All @@ -52,8 +51,7 @@ export const Click: StoryObj = {
render: (args) => createRichTooltip(args, 'Click'),
args: {
...RichTooltipComponentArgs,
element: 'click',
placement: 'top',
placement: 'right',
action: 'click',
open: false,
},
Expand All @@ -63,7 +61,6 @@ export const Opened: StoryObj = {
render: (args) => createRichTooltip(args, 'Opened'),
args: {
...RichTooltipComponentArgs,
element: 'opened',
placement: 'left',
action: 'click',
open: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ const createTooltip = (args, buttonText = 'Hover') => (
<AtomButton
fill='solid'
size='large'
id={args.element}
aria-describedby='atom-tooltip'
id={buttonText}
aria-describedby='atom-rich-tooltip'
>
{buttonText}
</AtomButton>

<AtomRichTooltip
id='atom-tooltip'
id='atom-rich-tooltip'
placement={args.placement}
element={args.element}
element={buttonText}
title={args.title}
action={args.action}
actionText={args.actiontext}
Expand All @@ -37,34 +37,12 @@ const createTooltip = (args, buttonText = 'Hover') => (
</>
)

export const Hover: StoryObj = {
render: (args) => createTooltip(args, 'Hover'),
args: {
...RichTooltipComponentArgs,
element: 'hover',
placement: 'top',
open: false,
},
}

export const Click: StoryObj = {
render: (args) => createTooltip(args, 'Click'),
args: {
...RichTooltipComponentArgs,
element: 'click',
placement: 'top',
action: 'click',
open: false,
},
}

export const Opened: StoryObj = {
render: (args) => createTooltip(args, 'Opened'),
args: {
...RichTooltipComponentArgs,
element: 'opened',
placement: 'left',
action: 'click',
open: true,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ const createTooltip = (args, buttonText = 'Hover') => ({
<AtomButton
fill="solid"
size="large"
:id="args.element"
aria-describedby="atom-tooltip"
:id="buttonText"
aria-describedby="atom-rich-tooltip"
>
{{ buttonText }}
</AtomButton>
<AtomRichTooltip
id="atom-tooltip"
id="atom-rich-tooltip"
:placement="args.placement"
:element="args.element"
:element="buttonText"
:title="args.title"
:action="args.action"
:actionText="args.actiontext"
Expand All @@ -46,7 +46,6 @@ export const Hover: StoryObj = {
render: (args) => createTooltip(args, 'Hover'),
args: {
...RichTooltipComponentArgs,
element: 'hover',
placement: 'top',
open: false,
},
Expand All @@ -56,7 +55,6 @@ export const Click: StoryObj = {
render: (args) => createTooltip(args, 'Click'),
args: {
...RichTooltipComponentArgs,
element: 'click',
placement: 'top',
action: 'click',
open: false,
Expand All @@ -68,7 +66,6 @@ export const Opened: StoryObj = {
args: {
...RichTooltipComponentArgs,
element: 'opened',
placement: 'left',
action: 'click',
open: true,
},
Expand Down

0 comments on commit ce387a2

Please sign in to comment.