@latte-macchiat-io/latte-vanilla-components 0.0.456 → 0.0.458
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { alertBoxContent, AlertBoxVariants } from './styles.css';
|
|
2
2
|
|
|
3
|
-
import { AlertVariant } from './types';
|
|
4
3
|
import { Box } from '..';
|
|
5
4
|
|
|
6
5
|
import { themeContract } from '../../../theme/contract.css';
|
|
7
|
-
|
|
6
|
+
|
|
8
7
|
import { Heading } from '../../Heading';
|
|
9
8
|
import { Icon } from '../../Icon';
|
|
10
9
|
import icons from '../../Icon/path';
|
|
11
10
|
import { Paragraph } from '../../Paragraph';
|
|
12
11
|
|
|
13
|
-
export type AlertBoxProps =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
12
|
+
export type AlertBoxProps = React.HTMLAttributes<HTMLDivElement> &
|
|
13
|
+
AlertBoxVariants & {
|
|
14
|
+
text: string;
|
|
15
|
+
noIcon?: boolean;
|
|
16
|
+
title?: string | null;
|
|
17
|
+
};
|
|
19
18
|
|
|
20
19
|
export const AlertBox = ({ title, text, noIcon = false, variant = 'info', className }: AlertBoxProps) => {
|
|
21
20
|
return (
|
|
22
|
-
<Box className={className} variant={variant}>
|
|
21
|
+
<Box className={className} variant={variant} direction="row">
|
|
23
22
|
{!noIcon && <Icon iconPath={icons.close} size={50} color={themeContract.boxAlert.variant[variant].iconColor} />}
|
|
24
23
|
<div className={alertBoxContent}>
|
|
25
24
|
{title && <Heading as="h4">{title}</Heading>}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { AlertBox } from '.';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
|
+
const meta: Meta<typeof AlertBox> = {
|
|
7
|
+
title: 'Latte Components / 1. Global / AlertBox',
|
|
8
|
+
component: AlertBox,
|
|
9
|
+
parameters: {
|
|
10
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
16
|
+
argTypes: {},
|
|
17
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
title: 'Lorem ipsum',
|
|
27
|
+
text: 'Lorem ipsum Lorem ipsum',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -10,7 +10,7 @@ export const themeBoxAlertLight = {
|
|
|
10
10
|
iconColor: '',
|
|
11
11
|
backgroundColor: '',
|
|
12
12
|
},
|
|
13
|
-
info: { iconColor: '', backgroundColor: '' },
|
|
13
|
+
info: { iconColor: '', backgroundColor: '#FF0000' },
|
|
14
14
|
success: { iconColor: '', backgroundColor: '' },
|
|
15
15
|
danger: { iconColor: '', backgroundColor: '' },
|
|
16
16
|
},
|