Skip to content

Commit

Permalink
Fix(core/card|push-card) set correct cursors and adjust styling (#1621)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Maurer <[email protected]>
Co-authored-by: matthiashader <[email protected]>
Co-authored-by: matthias <[email protected]>
  • Loading branch information
4 people authored Jan 16, 2025
1 parent 66f8d29 commit e263955
Show file tree
Hide file tree
Showing 34 changed files with 182 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-bags-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@siemens/ix": patch
---

Set correct cursors and handle overflow for **ix-card** and **ix-push-card**.
17 changes: 12 additions & 5 deletions packages/core/src/components/card-content/card-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@

:host {
@include ix-component;

display: flex;
position: relative;
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
padding: 1rem;
height: 100%;
overflow: hidden;

.content-wrapper {
box-sizing: border-box;
height: 100%;
width: 100%;
overflow: hidden;
gap: 0.5rem;
display: flex;
flex-direction: column;
align-items: flex-start;
}
}
4 changes: 3 additions & 1 deletion packages/core/src/components/card-content/card-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class CardContent {
render() {
return (
<Host>
<slot></slot>
<div class="content-wrapper">
<slot></slot>
</div>
</Host>
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/card-list/card-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ $CardList__Title__Height: 1.5rem;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}

.Show__All__Card__Icon {
Expand Down
20 changes: 11 additions & 9 deletions packages/core/src/components/card-list/card-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,17 @@ export class CardList {
})
}
>
<ix-card-content class="Show__All__Card__Content">
<ix-icon
name={'more-menu'}
size={'32'}
class={'Show__All__Card__Icon'}
></ix-icon>
<span class="Show__All__Card__Text">
{this.i18nMoreCards} ({this.numberOfOverflowingElements})
</span>
<ix-card-content>
<div class="Show__All__Card__Content">
<ix-icon
name={'more-menu'}
size={'32'}
class={'Show__All__Card__Icon'}
></ix-icon>
<span class="Show__All__Card__Text">
{this.i18nMoreCards} ({this.numberOfOverflowingElements})
</span>
</div>
</ix-card-content>
</ix-card>
) : null}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/card-title/card-title.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
flex-direction: row;
align-items: center;
margin-top: 0.25rem;
margin-bottom: $small-space;
margin-bottom: 0.25rem;
gap: $default-space;

width: 100%;
Expand All @@ -17,6 +17,6 @@
flex-direction: row;
gap: 0.25rem;
margin-left: auto;
margin-right: 0px;
margin-right: 0;
}
}
8 changes: 8 additions & 0 deletions packages/core/src/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
align-items: flex-start;
align-self: flex-start;
overflow: hidden;
cursor: pointer;

width: 20rem;

Expand All @@ -32,6 +33,13 @@
background-color: var(--ix-card-background, transparent);
border-top-left-radius: var(--theme-default-border-radius);
border-top-right-radius: var(--theme-default-border-radius);
overflow: hidden;
}

.card-content-wrapper {
height: 100%;
width: 100%;
box-sizing: border-box;
}

.card-footer {
Expand Down
11 changes: 10 additions & 1 deletion packages/core/src/components/push-card/push-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
display: block;
position: relative;

ix-card {
cursor: default;
}

ix-card-accordion {
cursor: pointer;
}

.icon {
transform: scale(1.25);
height: 2.5rem;
width: 2.5rem;
}

.notification {
Expand Down
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.
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/card.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ regressionTest.describe('card: basic', () => {
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});
});

regressionTest.describe('card: overflow', () => {
regressionTest('should hide overflowing text', async ({ page }) => {
await page.goto('card/overflow');
expect(await page.screenshot({ fullPage: true })).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.
39 changes: 39 additions & 0 deletions packages/core/src/tests/card/overflow/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
SPDX-FileCopyrightText: 2025 Siemens AG
SPDX-License-Identifier: MIT
-->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
<style>
ix-card {
margin: 1rem;
height: 12rem;
width: 12rem;
}
</style>
</head>
<body>
<ix-card>
<ix-card-content>
<ix-typography>
This is an example text for testing the overflow behavior. This is an
example text for testing the overflow behavior. This is an example
text for testing the overflow behavior. This is an example text for
testing the overflow behavior. This is an example text for testing the
overflow behavior. This is an example text for testing the overflow
behavior.
</ix-typography>
</ix-card-content>
</ix-card>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions packages/core/src/tests/push-card/overflow/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--
SPDX-FileCopyrightText: 2025 Siemens AG
SPDX-License-Identifier: MIT
-->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
<style>
ix-push-card {
margin: 1rem;
}
</style>
</head>
<body>
<ix-push-card
icon="bulb"
notification="99"
heading="This is an example text for testing the overflow behavior."
subheading="This is an example text for testing the overflow behavior. This is an
example text for testing the overflow behavior. This is an example
text for testing the overflow behavior. This is an example text for
testing the overflow behavior. This is an example text for testing the
overflow behavior. This is an example text for testing the overflow
behavior."
>
</ix-push-card>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions packages/core/src/tests/push-card/push-card.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ regressionTest.describe('push-card: basic', () => {
});
});

regressionTest.describe('push-card: overflow', () => {
regressionTest('should hide overflowing text', async ({ page }) => {
await page.goto('push-card/overflow');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});
});

test('push card expand', async ({ page, mount }) => {
await mount(`
<ix-push-card
Expand Down
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.
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.
2 changes: 1 addition & 1 deletion packages/react-test-app/src/preview-examples/card-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default () => {
<>
<IxCardList label="Stack Layout" showAllCount={12} listStyle={'stack'}>
<IxPushCard
icon="rocket"
icon="bulb"
notification="3"
heading="Heading content"
subheading="Subheading"
Expand Down
39 changes: 39 additions & 0 deletions packages/storybook-docs/src/stories/push-card.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type { ArgTypes, Meta, StoryObj } from '@storybook/web-components';
import type { Components } from '@siemens/ix/components';
import { genericRender, makeArgTypes } from './utils/generic-render';

type Element = Components.IxPushCard & { defaultSlot: string };

const meta = {
title: 'Example/PushCard',
tags: [],
render: (args) => genericRender('ix-push-card', args),
argTypes: makeArgTypes<Partial<ArgTypes<Element>>>('ix-push-card', {
defaultSlot: {
control: 'text',
},
}),
args: {
defaultSlot: '',
},
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/design/r2nqdNNXXZtPmWuVjIlM1Q/iX-Components---Brand-Dark?node-id=6396-139080&m=dev',
},
},
} satisfies Meta<Element>;

export default meta;
type Story = StoryObj<Element>;

export const Default: Story = {
args: {
defaultSlot: ``,
icon: 'bulb',
notification: '99',
heading: 'Heading content',
subheading: 'Subheading',
variant: 'insight',
},
};

0 comments on commit e263955

Please sign in to comment.