Skip to content

Commit

Permalink
feat(ui): add PreviewAlert to ui
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 committed Nov 20, 2023
1 parent 0ddf42e commit 053985d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/ui/src/components/PreviewAlert/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.utrecht-preview-mode {
--utrecht-space-around: 0;
--utrecht-alert-padding-block-start: var(--utrecht-preview-mode-padding-block-start, 10px);
--utrecht-alert-padding-block-end: var(--utrecht-preview-mode-padding-block-end, 10px);

inline-size: 100%;
text-align: center;
}
23 changes: 23 additions & 0 deletions packages/ui/src/components/PreviewAlert/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Alert, Link, Paragraph } from '@utrecht/component-library-react';
import classnames from 'classnames/bind';
import styles from './index.module.scss';

const css = classnames.bind(styles);

type LinkTypes = {
href: string;
text: string;
};

export interface PreviewAlertProps {
link: LinkTypes;
message: string;
}

export const PreviewAlert = ({ link, message }: PreviewAlertProps) => (
<Alert type="warning" className={css('utrecht-preview-mode')}>
<Paragraph>
{message} <Link href={link.href}>{link.text}</Link>
</Paragraph>
</Alert>
);
2 changes: 2 additions & 0 deletions packages/ui/src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export * from './LogoButton';
export * from './Markdown';
export * from './MultiColumnsLogoButton';
export * from './Navigation';
export { PreviewAlert } from './PreviewAlert';
export type { PreviewAlertProps } from './PreviewAlert';
export * from './PriceWidget';

0 comments on commit 053985d

Please sign in to comment.