generated from openmcp-project/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Illustrated Banner Component #86
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
Merged
Hubert-Szczepanski-SAP
merged 8 commits into
main
from
feature/illustrated-banner-common-component
May 2, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
653879b
Illustrated Banner Component
Hubert-Szczepanski-SAP b26816b
PR changes
Hubert-Szczepanski-SAP bbb07e6
Linting issues fix + rebase
Hubert-Szczepanski-SAP d7f357d
tests fix
Hubert-Szczepanski-SAP 89e8307
tests fix 2
Hubert-Szczepanski-SAP 4a38626
PR changes
Hubert-Szczepanski-SAP 50976d9
tests fix
Hubert-Szczepanski-SAP f208f84
fix
Hubert-Szczepanski-SAP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file removed
BIN
-95 KB
...mationDialog -- should display correct resource name in all labels (failed).png
Binary file not shown.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
34 changes: 0 additions & 34 deletions
34
src/components/ControlPlanes/NoManagedControlPlaneBanner.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,28 +1,21 @@ | ||
import { IllustratedMessage } from '@ui5/webcomponents-react'; | ||
import '@ui5/webcomponents-fiori/dist/illustrations/SimpleError'; | ||
import IllustrationMessageDesign from '@ui5/webcomponents-fiori/dist/types/IllustrationMessageDesign.js'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { IllustratedBanner } from '../Ui/IllustratedBanner/IllustratedBanner'; | ||
import IllustrationMessageType from '@ui5/webcomponents-fiori/dist/types/IllustrationMessageType.js'; | ||
|
||
interface Props { | ||
title?: string; | ||
subtitleText?: string; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
error?: any; | ||
details?: string; | ||
} | ||
|
||
export default function IllustratedError({ | ||
title, | ||
subtitleText, | ||
error, | ||
}: Props) { | ||
export default function IllustratedError({ title, details }: Props) { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<IllustratedMessage | ||
name="SimpleError" | ||
design={IllustrationMessageDesign.Spot} | ||
titleText={title ?? t('IllustratedError.titleText')} | ||
subtitleText={error ?? subtitleText ?? t('IllustratedError.subtitleText')} | ||
<IllustratedBanner | ||
illustrationName={IllustrationMessageType.SimpleError} | ||
title={title ?? t('IllustratedError.titleText')} | ||
subtitle={details ?? t('IllustratedError.subtitleText')} | ||
/> | ||
); | ||
} |
60 changes: 60 additions & 0 deletions
60
src/components/Ui/IllustratedBanner/IllustratedBanner.test.tsx
This file contains hidden or 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,60 @@ | ||
import IllustrationMessageType from '@ui5/webcomponents-fiori/dist/types/IllustrationMessageType.js'; | ||
import { IllustratedBanner } from './IllustratedBanner'; | ||
import '@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js'; | ||
|
||
describe('<IllustratedBanner />', () => { | ||
it('renders title and subtitle', () => { | ||
cy.mount( | ||
<IllustratedBanner | ||
title="Test title" | ||
subtitle="Test subtitle" | ||
illustrationName={IllustrationMessageType.NoData} | ||
/>, | ||
); | ||
|
||
cy.contains('Test title').should('be.visible'); | ||
cy.contains('Test subtitle').should('be.visible'); | ||
}); | ||
|
||
it('renders help button with correct text and icon', () => { | ||
cy.mount( | ||
<IllustratedBanner | ||
title="With Help" | ||
subtitle="Subtitle" | ||
illustrationName={IllustrationMessageType.NoData} | ||
help={{ | ||
link: 'https://example.com', | ||
buttonText: 'Need Help?', | ||
}} | ||
/>, | ||
); | ||
|
||
cy.get('ui5-button').contains('Need Help?').should('be.visible'); | ||
cy.get('ui5-button').should( | ||
'have.attr', | ||
'icon', | ||
'sap-icon://question-mark', | ||
); | ||
}); | ||
|
||
it('renders a link with correct attributes', () => { | ||
cy.mount( | ||
<IllustratedBanner | ||
title="Click Test" | ||
subtitle="Check link attributes" | ||
illustrationName={IllustrationMessageType.NoData} | ||
help={{ | ||
link: 'https://example.com', | ||
buttonText: 'Go', | ||
}} | ||
/>, | ||
); | ||
|
||
cy.get('a') | ||
.should('have.attr', 'href', 'https://example.com') | ||
.and('have.attr', 'target', '_blank') | ||
.and('have.attr', 'rel', 'noreferrer'); | ||
|
||
cy.get('a').contains('Go'); | ||
}); | ||
}); |
This file contains hidden or 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,46 @@ | ||
import IllustrationMessageDesign from '@ui5/webcomponents-fiori/dist/types/IllustrationMessageDesign.js'; | ||
import IllustrationMessageType from '@ui5/webcomponents-fiori/dist/types/IllustrationMessageType.js'; | ||
import { FlexBox, IllustratedMessage, Button } from '@ui5/webcomponents-react'; | ||
import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js'; | ||
import '@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js'; | ||
|
||
type InfoBannerProps = { | ||
title: string; | ||
subtitle: string; | ||
illustrationName: IllustrationMessageType; // e.g. 'NoData', 'SimpleError', etc. | ||
help?: { | ||
link: string; | ||
buttonText: string; | ||
buttonIcon?: string; | ||
}; | ||
}; | ||
|
||
export const IllustratedBanner = ({ | ||
title, | ||
subtitle, | ||
illustrationName, | ||
help, | ||
}: InfoBannerProps) => { | ||
return ( | ||
<FlexBox direction="Column" alignItems="Center"> | ||
<IllustratedMessage | ||
design={IllustrationMessageDesign.Spot} | ||
name={illustrationName} | ||
titleText={title} | ||
subtitleText={subtitle} | ||
/> | ||
{help && ( | ||
<a href={help.link} target="_blank" rel="noreferrer"> | ||
<Button | ||
design={ButtonDesign.Transparent} | ||
icon={ | ||
help.buttonIcon ? help.buttonIcon : 'sap-icon://question-mark' | ||
} | ||
> | ||
{help.buttonText} | ||
</Button> | ||
</a> | ||
)} | ||
</FlexBox> | ||
); | ||
}; |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.