diff --git a/src/tedi/components/buttons/info-button/info-button.module.scss b/src/tedi/components/buttons/info-button/info-button.module.scss
index 6f2fc8db..8a7ac2a7 100644
--- a/src/tedi/components/buttons/info-button/info-button.module.scss
+++ b/src/tedi/components/buttons/info-button/info-button.module.scss
@@ -3,4 +3,12 @@
height: var(--button-xs-icon-size);
min-height: var(--button-xs-icon-size);
vertical-align: bottom;
+
+ &[data-variant='inverted']:hover:not(:disabled) {
+ background-color: var(--button-main-neutral-inverted-icon-only-background-hover);
+ }
+
+ &[data-variant='inverted']:active:not(:disabled) {
+ background-color: var(--button-main-neutral-inverted-icon-only-background-active);
+ }
}
diff --git a/src/tedi/components/buttons/info-button/info-button.spec.tsx b/src/tedi/components/buttons/info-button/info-button.spec.tsx
index b450f9a3..ad642916 100644
--- a/src/tedi/components/buttons/info-button/info-button.spec.tsx
+++ b/src/tedi/components/buttons/info-button/info-button.spec.tsx
@@ -66,4 +66,30 @@ describe('InfoButton Component', () => {
expect(button).toHaveAttribute('title', 'Info button');
expect(button).toHaveAttribute('id', 'info-button-id');
});
+
+ it('applies default color variant correctly', () => {
+ render(Info);
+ const button = screen.getByRole('button');
+ expect(button).not.toHaveAttribute('data-variant');
+ });
+
+ it('applies inverted color variant correctly', () => {
+ render(Info);
+ const button = screen.getByRole('button');
+ expect(button).toHaveAttribute('data-variant', 'inverted');
+ });
+
+ it('applies the inverted variant and still renders children', () => {
+ render(
+
+ Child content
+
+ );
+ const button = screen.getByRole('button');
+ expect(button).toHaveAttribute('data-variant', 'inverted');
+
+ const child = screen.getByTestId('child');
+ expect(child).toBeInTheDocument();
+ expect(child).toHaveTextContent('Child content');
+ });
});
diff --git a/src/tedi/components/buttons/info-button/info-button.stories.tsx b/src/tedi/components/buttons/info-button/info-button.stories.tsx
index 6cf4a3cb..2f5f1869 100644
--- a/src/tedi/components/buttons/info-button/info-button.stories.tsx
+++ b/src/tedi/components/buttons/info-button/info-button.stories.tsx
@@ -28,20 +28,29 @@ const buttonStateArray = ['Default', 'Hover', 'Active', 'Focus'];
type TemplateMultipleProps = {
array: typeof buttonStateArray;
+ color?: 'default' | 'inverted';
};
const TemplateColumn: StoryFn = (args) => {
- const { array, ...buttonProps } = args;
+ const { array, color = 'default', ...buttonProps } = args;
return (
{array.map((state, index) => (
- {state}
+
+ {state}
+
-
+
Info button
@@ -57,7 +66,7 @@ export const Default: Story = {
},
};
-export const InfoButtonStates: StoryObj = {
+export const States: StoryObj = {
render: TemplateColumn,
args: {
array: buttonStateArray,
@@ -70,3 +79,19 @@ export const InfoButtonStates: StoryObj = {
},
},
};
+
+export const Inverted: StoryObj = {
+ render: TemplateColumn,
+ args: {
+ array: buttonStateArray,
+ color: 'inverted',
+ },
+ parameters: {
+ pseudo: {
+ hover: '#Hover',
+ active: '#Active',
+ focusVisible: '#Focus',
+ },
+ backgrounds: { default: 'brand' },
+ },
+};
diff --git a/src/tedi/components/buttons/info-button/info-button.tsx b/src/tedi/components/buttons/info-button/info-button.tsx
index 69d524ce..0669f128 100644
--- a/src/tedi/components/buttons/info-button/info-button.tsx
+++ b/src/tedi/components/buttons/info-button/info-button.tsx
@@ -4,27 +4,33 @@ import React from 'react';
import { Button, ButtonProps } from '../button/button';
import styles from './info-button.module.scss';
-export interface InfoButtonProps extends Omit {
+export interface InfoButtonProps extends Omit {
/**
- * If true, applies a small size to the InfoButton.
+ * If true, applies a small size to the InfoButton
* @default false
*/
isSmall?: boolean;
/**
- * Children elements to be rendered inside the InfoButton.
+ * Children elements to be rendered inside the InfoButton
*/
children?: React.ReactNode;
+ /*
+ * Color variant of the InfoButton
+ * @default 'default'
+ */
+ color?: 'default' | 'inverted';
}
export const InfoButton = React.forwardRef(
- ({ isSmall, children, ...props }, ref): JSX.Element => (
+ ({ isSmall, children, color = 'default', ...props }, ref): JSX.Element => (