-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from 8845musign/modal-fix-header-and-footer
Modals with Sticky Hedaer & Sticky Footter
- Loading branch information
Showing
20 changed files
with
718 additions
and
169 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
import { type FC, type PropsWithChildren, useEffect } from 'react'; | ||
|
||
export const resetCss = { | ||
none: 'none', | ||
modernCss: 'modern css reset', | ||
} as const; | ||
|
||
export const ResetCssDecorator: FC< | ||
PropsWithChildren<{ | ||
applyResetCss: (typeof resetCss)[keyof typeof resetCss]; | ||
}> | ||
> = ({ children, applyResetCss }) => { | ||
useEffect(() => { | ||
const link = document.querySelector<HTMLLinkElement>('#reset-css'); | ||
|
||
if (!link) { | ||
return; | ||
} | ||
|
||
if (applyResetCss === resetCss.modernCss) { | ||
link.href = '/styles/modern-css-reset.css'; | ||
} else { | ||
link.href = ''; | ||
} | ||
}); | ||
|
||
return <>{children}</>; | ||
}; |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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,37 @@ | ||
import '@ubie/design-tokens/dist/tokens.css'; | ||
import { Preview } from '@storybook/react'; | ||
// @ts-ignore | ||
import { resetCss, ResetCssDecorator } from './decorators/ResetCssDecorator'; | ||
|
||
export const parameters = { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}; | ||
export const tags = ['autodocs']; | ||
|
||
const preview: Preview = { | ||
globalTypes: { | ||
resetCss: { | ||
description: 'Global theme for components', | ||
defaultValue: resetCss.modernCss, | ||
toolbar: { | ||
title: 'Reset CSS', | ||
icon: 'markup', | ||
items: [resetCss.none, resetCss.modernCss], | ||
}, | ||
}, | ||
}, | ||
decorators: [ | ||
(story, context) => { | ||
const applyResetCss = context.globals.resetCss || resetCss.none; | ||
|
||
return <ResetCssDecorator applyResetCss={applyResetCss}>{story()}</ResetCssDecorator>; | ||
}, | ||
], | ||
}; | ||
|
||
export default preview; |
This file contains 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,76 @@ | ||
/* Andy-set-studio/modern-css-reset https://github.com/Andy-set-studio/modern-css-reset */ | ||
|
||
/* Box sizing rules */ | ||
*, | ||
*::before, | ||
*::after { | ||
box-sizing: border-box; | ||
} | ||
|
||
/* Remove default margin */ | ||
body, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
p, | ||
figure, | ||
blockquote, | ||
dl, | ||
dd { | ||
margin: 0; | ||
} | ||
|
||
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */ | ||
ul[role="list"], | ||
ol[role="list"] { | ||
list-style: none; | ||
} | ||
|
||
/* Set core root defaults */ | ||
html:focus-within { | ||
scroll-behavior: smooth; | ||
} | ||
|
||
/* Set core body defaults */ | ||
body { | ||
min-height: 100vh; | ||
text-rendering: optimizespeed; | ||
line-height: 1.5; | ||
} | ||
|
||
/* A elements that don't have a class get default styles */ | ||
a:not([class]) { | ||
text-decoration-skip-ink: auto; | ||
} | ||
|
||
/* Make images easier to work with */ | ||
img, | ||
picture { | ||
display: block; | ||
max-width: 100%; | ||
} | ||
|
||
/* Inherit fonts for inputs and buttons */ | ||
input, | ||
button, | ||
textarea, | ||
select { | ||
font: inherit; | ||
} | ||
|
||
/* Remove all animations and transitions for people that prefer not to see them */ | ||
@media (prefers-reduced-motion: reduce) { | ||
html:focus-within { | ||
scroll-behavior: auto; | ||
} | ||
|
||
*, | ||
*::before, | ||
*::after { | ||
transition-duration: 0.01ms !important; | ||
animation-duration: 0.01ms !important; | ||
animation-iteration-count: 1 !important; | ||
scroll-behavior: auto !important; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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.