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

feat(core/card): add primary variant #780

Merged
merged 4 commits into from
Sep 26, 2023
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
18 changes: 15 additions & 3 deletions packages/core/component-doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
},
{
"name": "variant",
"type": "\"alarm\" | \"critical\" | \"info\" | \"insight\" | \"neutral\" | \"notification\" | \"success\" | \"warning\"",
"type": "\"alarm\" | \"critical\" | \"info\" | \"insight\" | \"neutral\" | \"notification\" | \"primary\" | \"success\" | \"warning\"",
"mutable": false,
"attr": "variant",
"reflectToAttr": false,
Expand Down Expand Up @@ -137,6 +137,10 @@
"value": "notification",
"type": "string"
},
{
"value": "primary",
"type": "string"
},
{
"value": "success",
"type": "string"
Expand Down Expand Up @@ -1017,7 +1021,7 @@
"props": [
{
"name": "variant",
"type": "\"alarm\" | \"critical\" | \"info\" | \"insight\" | \"neutral\" | \"notification\" | \"success\" | \"warning\"",
"type": "\"alarm\" | \"critical\" | \"info\" | \"insight\" | \"neutral\" | \"notification\" | \"primary\" | \"success\" | \"warning\"",
"mutable": false,
"attr": "variant",
"reflectToAttr": false,
Expand Down Expand Up @@ -1049,6 +1053,10 @@
"value": "notification",
"type": "string"
},
{
"value": "primary",
"type": "string"
},
{
"value": "success",
"type": "string"
Expand Down Expand Up @@ -8607,7 +8615,7 @@
},
{
"name": "variant",
"type": "\"alarm\" | \"critical\" | \"info\" | \"insight\" | \"neutral\" | \"notification\" | \"success\" | \"warning\"",
"type": "\"alarm\" | \"critical\" | \"info\" | \"insight\" | \"neutral\" | \"notification\" | \"primary\" | \"success\" | \"warning\"",
"mutable": false,
"attr": "variant",
"reflectToAttr": false,
Expand Down Expand Up @@ -8639,6 +8647,10 @@
"value": "notification",
"type": "string"
},
{
"value": "primary",
"type": "string"
},
{
"value": "success",
"type": "string"
Expand Down
20 changes: 20 additions & 0 deletions packages/core/src/components/action-card/action-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
ix-card.card-neutral:active {
--ix-card-background: var(--theme-color-neutral--active);
}

ix-card.card-primary:hover {
--ix-card-background: var(--theme-color-primary--hover);
}

ix-card.card-primary:active {
--ix-card-background: var(--theme-color-primary--active);
}
}

:host(:hover) {
Expand Down Expand Up @@ -122,6 +130,10 @@
ix-card.card-neutral:hover {
--ix-card-background: var(--theme-color-neutral--hover);
}

ix-card.card-primary:hover {
--ix-card-background: var(--theme-color-primary--hover);
}
}

:host(:active) {
Expand Down Expand Up @@ -156,6 +168,10 @@
ix-card.card-neutral:active {
--ix-card-background: var(--theme-color-neutral--active);
}

ix-card.card-primary:active {
--ix-card-background: var(--theme-color-primary--active);
}
}

:host(.selected) {
Expand Down Expand Up @@ -194,4 +210,8 @@
ix-card.card-neutral {
--ix-card-background: var(--theme-color-neutral--active);
}

ix-card.card-primary {
--ix-card-background: var(--theme-color-primary--active);
}
}
2 changes: 1 addition & 1 deletion packages/core/src/components/blind/blind.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import anime from 'animejs';
import { CardVariant } from '../card/card';
import { a11yBoolean } from '../utils/a11y';

export type BlindVariant = CardVariant | 'primary' | 'outline';
export type BlindVariant = CardVariant | 'outline';

let sequentialInstanceId = 0;

Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
color: var(--theme-color-neutral--contrast);
}

:host(.card-primary) {
--ix-card-background: var(--theme-color-primary);
color: var(--theme-color-neutral--contrast);
}

:host(:not(.card-insight)) {
--ix-card-border-color: transparent;
}
3 changes: 2 additions & 1 deletion packages/core/src/components/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export type CardVariant =
| 'warning'
| 'info'
| 'neutral'
| 'success';
| 'success'
| 'primary';

/**
* @since 1.6.0
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/components/push-card/push-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
ix-card.card-neutral:hover {
--ix-card-background: var(--theme-color-neutral--hover);
}

ix-card.card-primary:hover {
--ix-card-background: var(--theme-color-primary--hover);
}
}

:host(:active) {
Expand Down Expand Up @@ -90,4 +94,8 @@
ix-card.card-neutral:active {
--ix-card-background: var(--theme-color-neutral--active);
}

ix-card.card-primary:active {
--ix-card-background: var(--theme-color-primary--active);
}
}
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.
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.
22 changes: 14 additions & 8 deletions packages/core/src/tests/action-card/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,57 @@
<body>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="notification"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="alarm"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="critical"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="warning"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="info"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="neutral"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="success"
></ix-action-card>
<ix-action-card
icon="refresh"
heading="Scan for new devices"
subheading="Secondary text"
variant="primary"
></ix-action-card>
<ix-action-card>
<div class="d-flex flex-column align-items-center" style="color: #ff00ff">
<ix-icon name="refresh"></ix-icon>
Expand Down
23 changes: 15 additions & 8 deletions packages/core/src/tests/action-card/selected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,65 @@
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="notification"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="alarm"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="critical"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="warning"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="info"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="neutral"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan forn new devices"
heading="Scan for new devices"
subheading="Secondary text"
variant="success"
></ix-action-card>
<ix-action-card
selected
icon="refresh"
heading="Scan for new devices"
subheading="Secondary text"
variant="primary"
></ix-action-card>
<ix-action-card selected>
<div class="d-flex flex-column align-items-center" style="color: #ff00ff">
<ix-icon name="refresh"></ix-icon>
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/tests/card-list/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
subheading="Subheading"
variant="neutral"
></ix-push-card>
<ix-push-card
icon="bulb"
notification="99"
heading="Heading content"
subheading="Subheading"
variant="primary"
></ix-push-card>
</ix-card-list>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/tests/card-list/card-list.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ regressionTest.describe('card-list: basic', () => {
regressionTest('should not have visual regressions', async ({ page }) => {
await page.goto('card-list/basic');
await page.waitForTimeout(1000);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
expect(
await page.screenshot({ fullPage: true, animations: 'disabled' })
).toMatchSnapshot();
});

regressionTest('layout scrolling', async ({ page }) => {
await page.goto('card-list/layout-scroll');
await page.waitForTimeout(1000);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
expect(
await page.screenshot({ fullPage: true, animations: 'disabled' })
).toMatchSnapshot();
});

regressionTest('layout scrolling end', async ({ page }) => {
await page.goto('card-list/layout-scroll');

await page.locator('#end').scrollIntoViewIfNeeded();
await page.waitForTimeout(1000);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
expect(
await page.screenshot({ fullPage: true, animations: 'disabled' })
).toMatchSnapshot();
});
});
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.
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.
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.
7 changes: 7 additions & 0 deletions packages/core/src/tests/card-list/layout-scroll/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@
subheading="Subheading"
variant="success"
></ix-push-card>
<ix-push-card
icon="bulb"
notification="99"
heading="Heading content"
subheading="Subheading"
variant="primary"
></ix-push-card>
</ix-card-list>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/tests/push-card/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@
>
<ix-topography format="h2">Some Content</ix-topography>
</ix-push-card>
<ix-push-card
icon="bulb"
notification="99"
heading="Heading content"
subheading="Subheading"
variant="primary"
>
<ix-topography format="h2">Some Content</ix-topography>
</ix-push-card>
</div>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/tests/push-card/push-card.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { regressionTest } from '@utils/test';
regressionTest.describe('push-card: basic', () => {
regressionTest('should not have visual regressions', async ({ page }) => {
await page.goto('push-card/basic');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
expect(
await page.screenshot({ fullPage: true, animations: 'disabled' })
).toMatchSnapshot();
});

regressionTest('should click accordion', async ({ page }) => {
Expand All @@ -27,6 +29,8 @@ regressionTest.describe('push-card: basic', () => {
// Animation time
await page.waitForTimeout(500);

expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
expect(
await page.screenshot({ fullPage: true, animations: 'disabled' })
).toMatchSnapshot();
});
});
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.
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.