-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
349 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/wrapper-components/react-javascript/src/components/Notification/Notification.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { IfxNotification } from '@infineon/infineon-design-system-react'; | ||
|
||
function Notification() { | ||
return ( | ||
<div> | ||
<IfxNotification icon="c-check-16" variant="success" link-text="Link" link-href="https://www.example.com">Success notification</IfxNotification> | ||
<br /> | ||
<IfxNotification icon="lock-16" variant="warning" link-text="Link" link-href="https://www.example.com">Warning notification</IfxNotification> | ||
<br /> | ||
<IfxNotification icon="c-check-16" variant="error" link-text="Link" link-href="https://www.example.com">Error notification</IfxNotification> | ||
</div> | ||
); | ||
} | ||
|
||
export default Notification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/wrapper-components/react-vite-js/src/components/Notification/Notification.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { IfxNotification } from '@infineon/infineon-design-system-react'; | ||
|
||
function Notification() { | ||
return ( | ||
<div> | ||
<IfxNotification icon="c-check-16" variant="success" link-text="Link" link-href="https://www.example.com">Success notification</IfxNotification> | ||
<br /> | ||
<IfxNotification icon="lock-16" variant="warning" link-text="Link" link-href="https://www.example.com">Warning notification</IfxNotification> | ||
<br /> | ||
<IfxNotification icon="c-check-16" variant="error" link-text="Link" link-href="https://www.example.com">Error notification</IfxNotification> | ||
</div> | ||
); | ||
} | ||
|
||
export default Notification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
examples/wrapper-components/vue-javascript/src/components/Notification.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<div> | ||
<h2>Notification</h2> | ||
<ifx-notification icon="c-check-16" variant="success" link-text="Link" link-href="https://www.example.com">Success notification</ifx-notification> | ||
<br /> | ||
<ifx-notification icon="lock-16" variant="warning" link-text="Link" link-href="https://www.example.com">Warning notification</ifx-notification> | ||
<br /> | ||
<ifx-notification icon="c-check-16" variant="error" link-text="Link" link-href="https://www.example.com">Error notification</ifx-notification> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
packages/components/src/components/notification/notification.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { newE2EPage } from "@stencil/core/testing"; | ||
|
||
describe('Notification', () => { | ||
it('should render', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification>42</ifx-notification>'); | ||
|
||
const notification = await page.find('ifx-notification'); | ||
expect(notification).toHaveClass('hydrated'); | ||
}); | ||
|
||
it('should apply success class', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification variant="success">42</ifx-notification>'); | ||
|
||
const notification = await page.find('ifx-notification >>> .ifx-notification__wrapper'); | ||
expect(notification).toHaveClass('ifx-notification__wrapper--success'); | ||
}); | ||
|
||
it('should apply warning class', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification variant="warning">42</ifx-notification>'); | ||
|
||
const notification = await page.find('ifx-notification >>> .ifx-notification__wrapper'); | ||
expect(notification).toHaveClass('ifx-notification__wrapper--warning'); | ||
}); | ||
|
||
it('should apply error class', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification variant="error">42</ifx-notification>'); | ||
|
||
const notification = await page.find('ifx-notification >>> .ifx-notification__wrapper'); | ||
expect(notification).toHaveClass('ifx-notification__wrapper--error'); | ||
}); | ||
|
||
it('should render icon', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification icon="c-check-16">42</ifx-notification>'); | ||
|
||
const icon = await page.find('ifx-notification >>> .ifx-notification__icon'); | ||
expect(icon).not.toBeNull(); | ||
}); | ||
|
||
it('should render link', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification link-text="Link" link-href="https://www.example.com">42</ifx-notification>'); | ||
|
||
const link = await page.find('ifx-notification >>> .ifx-notification__link'); | ||
expect(await link.find('ifx-link')).not.toBeNull(); | ||
expect(link).not.toBeNull(); | ||
}); | ||
|
||
it('should render content', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification>42</ifx-notification>'); | ||
|
||
const content = await page.find('ifx-notification >>> .ifx-notification__content'); | ||
expect(content).not.toBeNull(); | ||
}); | ||
|
||
it('should render slot content', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<ifx-notification>42</ifx-notification>'); | ||
|
||
const content = await page.find('ifx-notification >>> .ifx-notification__content'); | ||
expect(await content.find('slot')).not.toBeNull(); | ||
}); | ||
}); |
65 changes: 65 additions & 0 deletions
65
packages/components/src/components/notification/notification.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@use "~@infineon/design-system-tokens/dist/tokens"; | ||
@use "../../global/font.scss"; | ||
|
||
.ifx-notification__wrapper { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
|
||
padding: tokens.$ifxSpace100 tokens.$ifxSpace200; | ||
|
||
background-color: tokens.$ifxColorBaseWhite; | ||
font-family: var(--ifx-font-family); | ||
color: tokens.$ifxColorBaseBlack; | ||
|
||
border: tokens.$ifxBorderWidth12 solid tokens.$ifxColorEngineering200; | ||
|
||
&.ifx-notification__wrapper--success { | ||
border-left: tokens.$ifxBorderWidth50 solid tokens.$ifxColorGreen500; | ||
|
||
& .ifx-notification__icon { | ||
color: tokens.$ifxColorGreen500; | ||
} | ||
} | ||
|
||
&.ifx-notification__wrapper--warning { | ||
border-left: tokens.$ifxBorderWidth50 solid tokens.$ifxColorOrange500; | ||
|
||
& .ifx-notification__icon { | ||
color: tokens.$ifxColorOrange500; | ||
} | ||
} | ||
|
||
&.ifx-notification__wrapper--error { | ||
border-left: tokens.$ifxBorderWidth50 solid tokens.$ifxColorRed500; | ||
|
||
& .ifx-notification__icon { | ||
color: tokens.$ifxColorRed500; | ||
} | ||
} | ||
|
||
& .ifx-notification__icon { | ||
margin-right: tokens.$ifxSpace100; | ||
display: flex; | ||
} | ||
|
||
& .ifx-notification__body { | ||
display: flex; | ||
flex-direction: row; | ||
flex-grow: 1; | ||
|
||
& .ifx-notification__slot { | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
@media (max-width: tokens.$ifxBreakpointXs) { | ||
& .ifx-notification__icon { | ||
align-self: flex-start; | ||
} | ||
|
||
& .ifx-notification__body { | ||
flex-direction: column; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/components/src/components/notification/notification.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export default { | ||
title: 'Components/Notification', | ||
tags: ['autodocs'], | ||
|
||
args: { | ||
content: "Sample Notification", | ||
variant: 'success', | ||
icon: 'c-check-16', | ||
linkText: 'Link', | ||
linkHref: 'https://www.example.com', | ||
linkTarget: '_blank', | ||
}, | ||
argTypes: { | ||
content: { | ||
description: 'Text inside the notification is passed as slot.', | ||
}, | ||
variant: { | ||
description: 'Variant of the notification.', | ||
options: ['success', 'warning', 'error'], | ||
control: { type: 'radio' }, | ||
}, | ||
icon: { | ||
description: 'The icon to be displayed in the notification.', | ||
}, | ||
linkText: { | ||
description: 'Text for the link.', | ||
}, | ||
linkHref: { | ||
description: 'URL for the link.', | ||
}, | ||
linkTarget:{ | ||
options: ['_blank', '_self', '_parent'], | ||
control: { type: 'radio' }, | ||
}, | ||
}, | ||
}; | ||
|
||
const DefaultTemplate = args => `<ifx-notification | ||
icon="${args.icon}" | ||
variant="${args.variant}" | ||
link-text="${args.linkText}" | ||
link-href="${args.linkHref}" | ||
link-target="${args.linkTarget}"> | ||
${args.content} | ||
</ifx-notification>`; | ||
|
||
export const Default = DefaultTemplate.bind({}); | ||
Default.argTypes = {}; |
Oops, something went wrong.