Skip to content

Commit

Permalink
docs: specify custom CSS variable for the toast spacing example
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Jan 4, 2024
1 parent f6c306b commit 08add4c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const FormGroup = (props) => (
<Box mb="4x" {...props} />
);

const ToastApp = ({ toastSpacing }) => {
const ToastApp = () => {
const counterRef = useRef(0);
const toast = useToastManager();

Expand All @@ -17,7 +17,7 @@ const ToastApp = ({ toastSpacing }) => {
const render = ({ data, onClose, placement }) => {
const toastSpacingKey = isTop ? 'pb' : 'pt';
const styleProps = {
[toastSpacingKey]: toastSpacing,
[toastSpacingKey]: 'var(--data-toast-spacing)',
width: 320,
};
return (
Expand Down Expand Up @@ -103,6 +103,7 @@ const App = () => {
<ToastManager
TransitionProps={{
sx: {
'--data-toast-spacing': `${toastSpacing}px`,
'[data-toast-placement^="top"] > &:first-of-type': {
mt: edgeSpacing, // the space to the top edge of the screen
},
Expand All @@ -118,7 +119,7 @@ const App = () => {
},
}}
>
<ToastApp toastSpacing={toastSpacing} />
<ToastApp />
</ToastManager>
</>
);
Expand Down

0 comments on commit 08add4c

Please sign in to comment.