Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix button css and story issues #2880

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/react/src/component-tests/IcButton/IcButton.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,14 @@ describe("IcButton visual regression and a11y tests", () => {

cy.checkHydrated(IC_BUTTON_SELECTOR);

cy.findShadowEl(IC_BUTTON_SELECTOR, "ic-loading-indicator").then(
(loadingIndicators) => {
for (let i = 0; i < loadingIndicators.length; i++) {
cy.wrap(loadingIndicators[i]).invoke("attr", "progress", 50);
}
}
);

cy.checkA11yWithWait();
cy.wait(500).compareSnapshot({
name: "icon-variants-button-group",
Expand Down
36 changes: 36 additions & 0 deletions packages/react/src/component-tests/IcButton/IcButtonTestData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export const iconProps = {
disabled: false,
monochrome: false,
},
iconLoading: {
title: "Default",
size: "medium",
theme: "light",
loading: true,
disabled: false,
monochrome: false,
},
iconDisabled: {
title: "Disabled",
size: "medium",
Expand All @@ -49,6 +57,22 @@ export const iconProps = {
disabled: false,
monochrome: true,
},
iconDarkLoading: {
title: "Dark",
size: "medium",
theme: "dark",
loading: true,
disabled: false,
monochrome: false,
},
iconDarkLoadingMonochrome: {
title: "Dark",
size: "medium",
theme: "dark",
loading: true,
disabled: false,
monochrome: true,
},
iconLight: {
title: "Light",
size: "medium",
Expand All @@ -57,6 +81,14 @@ export const iconProps = {
disabled: false,
monochrome: true,
},
iconLightLoadingMonochrome: {
title: "Light",
size: "medium",
theme: "light",
loading: true,
disabled: false,
monochrome: true,
},
};

export const SlottedIcon = () => {
Expand Down Expand Up @@ -787,9 +819,13 @@ export const IconButtonGroup = (): ReactElement => {
<IconBtnGroup props={iconProps.iconDefault} />
<IconBtnGroup props={iconProps.iconLarge} />
<IconBtnGroup props={iconProps.iconSmall} />
<IconBtnGroup props={iconProps.iconLoading} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you also add dark, non-monochrome loading buttons to this

<IconBtnGroup props={iconProps.iconDisabled} />
<IconBtnGroup props={iconProps.iconDark} />
<IconBtnGroup props={iconProps.iconDarkLoading} />
<IconBtnGroup props={iconProps.iconDarkLoadingMonochrome} />
<IconBtnGroup props={iconProps.iconLight} />
<IconBtnGroup props={iconProps.iconLightLoadingMonochrome} />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
background-color: var(
--ic-button-secondary-background-non-transparent-monochrome
);
color: var(--ic-button-primary-text);
}

:host(.ic-button-variant-secondary.background.monochrome) ::slotted(a),
Expand All @@ -395,6 +396,7 @@
background-color: var(
--ic-button-secondary-background-non-transparent-monochrome-disabled
);
color: var(--ic-button-secondary-text-disabled-monochrome);
}

:host(.ic-button-variant-secondary.background.monochrome.ic-button-disabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export const defaultArgs = {
<Story name="Icon variants" parameters={{ loki: { skip: true } }}>
{html`<div style="display:flex; gap: 1rem; flex-direction:column;">
<div>
<h1>Default</h1>
<ic-typography>Default</ic-typography>
<div style="display:flex; gap: 0.5rem">
<ic-button
variant="icon-primary"
Expand Down Expand Up @@ -420,7 +420,7 @@ export const defaultArgs = {
</div>
</div>
<div>
<h1>Small</h1>
<ic-typography>Small</ic-typography>
<div style="display:flex; gap: 0.5rem">
<ic-button
variant="icon-primary"
Expand Down Expand Up @@ -501,7 +501,7 @@ export const defaultArgs = {
</div>
</div>
<div>
<h1>Large</h1>
<ic-typography>Large</ic-typography>
<div style="display:flex; gap: 0.5rem">
<ic-button
variant="icon-primary"
Expand Down Expand Up @@ -582,7 +582,7 @@ export const defaultArgs = {
</div>
</div>
<div>
<h1>Loading</h1>
<ic-typography>Loading</ic-typography>
<div style="display:flex; gap: 0.5rem">
<ic-button
variant="icon-primary"
Expand Down Expand Up @@ -664,7 +664,7 @@ export const defaultArgs = {
</div>
</div>
<div>
<h1>Disabled</h1>
<ic-typography>Disabled</ic-typography>
<div style="display:flex; gap: 0.5rem">
<ic-button
variant="icon-primary"
Expand Down Expand Up @@ -745,7 +745,7 @@ export const defaultArgs = {
</div>
</div>
<div>
<h1>Light - monochrome</h1>
<ic-typography>Light - monochrome</ic-typography>
<div
style="width: fit-content; background-color: #ececec; padding: 0.5rem;"
>
Expand Down Expand Up @@ -874,7 +874,7 @@ export const defaultArgs = {
</ic-button>
</div>
</div>
<h1>Dark</h1>
<ic-typography>Dark</ic-typography>
<div
style="background-color:#474A48; padding: 0.5rem; width: fit-content;"
>
Expand Down Expand Up @@ -957,8 +957,10 @@ export const defaultArgs = {
</ic-button>
</div>
</div>
<h1>Dark Loading</h1>
<div style="padding: 0.5rem; width: fit-content;">
<ic-typography>Dark Loading</ic-typography>
<div
style="background-color:#474A48; padding: 0.5rem; width: fit-content;"
>
<div>
<ic-button
variant="icon-primary"
Expand Down Expand Up @@ -1042,8 +1044,10 @@ export const defaultArgs = {
</ic-button>
</div>
</div>
<h1>Dark - monochrome</h1>
<div style="padding: 0.5rem; width: fit-content;">
<ic-typography>Dark - monochrome</ic-typography>
<div
style="background-color:#474A48; padding: 0.5rem; width: fit-content;"
>
<div>
<ic-button
variant="icon-primary"
Expand Down
Loading