Skip to content

Commit 22779de

Browse files
authored
Fiddle: corrections for new styling + fix storybook (#10)
1 parent dfe9451 commit 22779de

6 files changed

Lines changed: 76 additions & 35 deletions

File tree

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import React from 'react';
2+
13
import type { Preview } from '@storybook/react-vite';
2-
import '@kibalabs/ui-react/styles/reset';
3-
import '@kibalabs/ui-react/styles/colors';
4+
5+
import '@kibalabs/ui-react/dist/index.css';
46
import '../src/styles.scss';
7+
import { ToastContainer } from '../src';
58

69
const preview: Preview = {
710
parameters: {
@@ -13,6 +16,14 @@ const preview: Preview = {
1316
},
1417
},
1518
},
19+
decorators: [
20+
(Story) => (
21+
<React.Fragment>
22+
<ToastContainer />
23+
<Story />
24+
</React.Fragment>
25+
),
26+
],
1627
};
1728

1829
export default preview;

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"react-hot-toast": "^2.4.1"
2626
},
2727
"devDependencies": {
28-
"@kibalabs/build": "0.13.3-next.12",
28+
"@kibalabs/build": "0.13.3-next.13",
2929
"@kibalabs/ui-react": "0.11.3-next.18",
3030
"@storybook/addon-docs": "10.1.2",
3131
"@storybook/react-vite": "10.1.2",

src/styles.scss

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
// Override react-hot-toast default styles - must be outside @layer for higher specificity
2+
.KibaToastContainer > div {
3+
max-width: none !important;
4+
background: none !important;
5+
box-shadow: none !important;
6+
padding: 0 !important;
7+
border-radius: 0 !important;
8+
}
9+
110
@layer kiba-structure {
211
@keyframes kiba-toast-fade-in {
312
0% {
@@ -24,6 +33,11 @@
2433
.KibaToast {
2534
display: flex;
2635
transition-duration: 0.3s;
36+
white-space: nowrap;
37+
outline: none;
38+
border: none;
39+
text-decoration: none;
40+
cursor: default;
2741
&.clickable {
2842
cursor: pointer;
2943
}
@@ -41,13 +55,54 @@
4155
width: 100%;
4256
height: 100%;
4357
position: relative;
58+
display: flex;
59+
box-sizing: border-box;
4460
}
4561
}
4662

4763
@layer kiba-theme {
4864
.KibaToast {
49-
.KibaToastFocusFixer {
65+
> .KibaToastFocusFixer {
66+
// Use same styling as card from ui-react
67+
background-color: var(--kiba-color-background-light10, #ffffff);
68+
border-color: var(--kiba-color-background-dark05, rgba(0, 0, 0, 0.05));
69+
border-width: var(--kiba-border-width, 1px);
70+
border-style: solid;
71+
border-radius: var(--kiba-border-radius, 0.5em);
72+
box-shadow: 0px 8px 8px -6px rgba(0, 0, 0, 0.15);
73+
padding: var(--kiba-padding, 0.5em) var(--kiba-padding-wide, 1em);
74+
color: var(--kiba-color-text, #333333);
5075
transition-duration: 0.3s;
5176
}
77+
&:hover > .KibaToastFocusFixer {
78+
background-color: var(--kiba-color-background, #ffffff);
79+
}
80+
&:active > .KibaToastFocusFixer {
81+
background-color: var(--kiba-color-background-dark10, #f0f0f0);
82+
}
83+
&:focus > .KibaToastFocusFixer {
84+
border-color: var(--kiba-color-background-dark50, rgba(0, 0, 0, 0.5));
85+
}
86+
// Variant styles
87+
&.success > .KibaToastFocusFixer {
88+
background-color: var(--kiba-color-success-clear90, #d4edda);
89+
color: var(--kiba-color-success-dark25, #155724);
90+
border-color: var(--kiba-color-success-clear75, #c3e6cb);
91+
}
92+
&.error > .KibaToastFocusFixer {
93+
background-color: var(--kiba-color-error-clear90, #f8d7da);
94+
color: var(--kiba-color-error-dark25, #721c24);
95+
border-color: var(--kiba-color-error-clear75, #f5c6cb);
96+
}
97+
&.warning > .KibaToastFocusFixer {
98+
background-color: var(--kiba-color-warning-clear90, #fff3cd);
99+
color: var(--kiba-color-warning-dark25, #856404);
100+
border-color: var(--kiba-color-warning-clear75, #ffeeba);
101+
}
102+
&.info > .KibaToastFocusFixer {
103+
background-color: var(--kiba-color-info-clear90, #d1ecf1);
104+
color: var(--kiba-color-info-dark25, #0c5460);
105+
border-color: var(--kiba-color-info-clear75, #bee5eb);
106+
}
52107
}
53108
}

src/toasts.css

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/useToastManager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const useToastManager = (): IToastManager => {
2323
// @ts-expect-error: not sure why classNam isn't expected on the component?
2424
React.cloneElement(component, { ...component.props, className: getClassName(...component.className || '', renderingToast.visible ? 'animateIn' : 'animateOut') })
2525
);
26-
toast.custom(wrappedComponent, { id: actualToastId, duration: shouldAutoClose ? autoCloseMillis : Infinity, style: { padding: '0' } });
26+
toast.custom(wrappedComponent, { id: actualToastId, duration: shouldAutoClose ? autoCloseMillis : Infinity, style: { padding: '0', background: 'none', boxShadow: 'none' } });
2727
return actualToastId;
2828
}, []);
2929

0 commit comments

Comments
 (0)