Skip to content

Commit

Permalink
fix: issue with showIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Nov 13, 2024
1 parent d029acb commit 740ab22
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/components/brand/brand.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function DBBrand(props: DBBrandProps) {
<div
ref={ref}
data-icon={props.hideLogo ? 'none' : (props.icon ?? DEFAULT_ICON)}
data-show-icon={getBooleanAsString(props.showIcon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
id={props.id}
class={cls('db-brand', props.className)}>
<Show when={props.text} else={props.children}>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/button/button.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function DBButton(props: DBButtonProps) {
disabled={props.disabled}
aria-label={props.label}
data-icon={props.icon}
data-show-icon={getBooleanAsString(props.showIcon ?? !!props.icon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-size={props.size}
data-state={props.state}
data-width={props.width}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function DBInfotext(props: DBInfotextProps) {
data-icon={props.icon}
data-semantic={props.semantic}
data-size={props.size}
data-show-icon={getBooleanAsString(props.showIcon)}>
data-hide-icon-after={getBooleanAsString(!props.showIcon)}>
<Show when={props.text} else={props.children}>
{props.text}
</Show>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/input/input.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default function DBInput(props: DBInputProps) {
<div
class={cls('db-input', props.className)}
data-variant={props.variant}
data-show-icon={getBooleanAsString(props.showIcon ?? !!props.icon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-icon={props.icon}
data-icon-after={props.iconAfter}>
<label htmlFor={state._id}>{props.label ?? DEFAULT_LABEL}</label>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/link/link.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function DBLink(props: DBLinkProps) {
aria-label={props.label}
aria-current={props.current}
data-size={props.size}
data-show-icon={getBooleanAsString(props.showIcon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-variant={props.variant}
data-content={props.content || 'internal'}
onClick={(event: ClickEvent<HTMLAnchorElement>) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function DBNavigationItem(props: DBNavigationItemProps) {
class={cls('db-navigation-item', props.className)}
data-width={props.width}
data-icon={props.icon}
data-show-icon={getBooleanAsString(props.showIcon ?? !!props.icon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-active={props.active}
aria-disabled={getBooleanAsString(props.disabled)}>
<Show when={!state.hasSubNavigation}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function DBNotification(props: DBNotificationProps) {
data-semantic={props.semantic}
data-variant={props.variant}
data-icon={props.icon}
data-show-icon={getBooleanAsString(props.showIcon ?? !!props.icon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-link-variant={props.linkVariant}>
<Slot name="image" />
<Show when={props.headline}>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/select/select.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default function DBSelect(props: DBSelectProps) {
class={cls('db-select', props.className)}
data-variant={props.variant}
data-icon={props.icon}
data-show-icon={getBooleanAsString(props.showIcon ?? !!props.icon)}>
data-hide-icon={getBooleanAsString(!props.showIcon)}>
<label htmlFor={state._id}>{props.label ?? DEFAULT_LABEL}</label>
<select
aria-invalid={props.customValidity === 'invalid'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ export default function DBTabItem(props: DBTabItemProps) {
htmlFor={props.id}
data-icon={props.icon}
data-icon-after={props.iconAfter}
data-show-icon={getBooleanAsString(
props.showIcon ?? !!props.icon
)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-no-text={props.noText}>
<input
disabled={props.disabled}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/tag/tag.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function DBTag(props: DBTagProps) {
data-semantic={props.semantic}
data-emphasis={props.emphasis}
data-icon={props.icon}
data-show-icon={getBooleanAsString(props.showIcon ?? !!props.icon)}
data-hide-icon={getBooleanAsString(!props.showIcon)}
data-no-text={getBooleanAsString(props.noText)}
data-overflow={getBooleanAsString(props.overflow)}>
{props.children}
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/shared/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type IconProps = {
export type ShowIconProps = {
/**
* Enables or disables the visibility of the icon. The default value depends on the component.
* For many components this property is optional to reflect figma properties.
*/
showIcon?: boolean;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/foundations/scss/icons/include.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}
}

[data-show-icon="false"],
[data-hide-icon="true"],
[data-icon="none"],
[data-icon-before="none"] {
&::before {
Expand All @@ -87,7 +87,7 @@
}
}

[data-show-icon="false"],
[data-hide-icon-after="true"],
[data-icon-after="none"] {
&::after {
content: none;
Expand Down

0 comments on commit 740ab22

Please sign in to comment.