New modal component
This commit is contained in:
parent
9474cba228
commit
7d40b5007e
2 changed files with 47 additions and 0 deletions
27
fwt/components/Modal.tsx
Normal file
27
fwt/components/Modal.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import '../styles/Modal.sass'
|
||||||
|
import { type JSXElement, Show, createSignal } from 'solid-js'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
children: JSXElement
|
||||||
|
background?: string
|
||||||
|
color?: string
|
||||||
|
border?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default (props: Props) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Show when={props.border}>
|
||||||
|
<div class="modal__content" style={`background-color: ${props.background}; color: ${props.color}; border: 2px solid ${props.border}`}>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
|
<Show when={!props.border}>
|
||||||
|
<div class="modal__content" style={`background-color: ${props.background}; color: ${props.color}; box-shadow: 5px 4px 6px rgba(0, 0, 0, 0.5)`}>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
20
fwt/styles/Modal.sass
Normal file
20
fwt/styles/Modal.sass
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
@use '/src/styles/variables.sass' as vars
|
||||||
|
@use 'sass:color'
|
||||||
|
|
||||||
|
.modal
|
||||||
|
display: flex
|
||||||
|
justify-content: center
|
||||||
|
align-items: center
|
||||||
|
position: fixed
|
||||||
|
top: 0
|
||||||
|
left: 0
|
||||||
|
width: 100%
|
||||||
|
height: 100%
|
||||||
|
backdrop-filter: blur(20px)
|
||||||
|
background-color: rgba(color.adjust(vars.$background, $blackness: 5%), 0.6)
|
||||||
|
z-index: 999
|
||||||
|
|
||||||
|
&__content
|
||||||
|
border-radius: 8px
|
||||||
|
padding: 2rem
|
||||||
|
position: relative
|
||||||
Loading…
Add table
Add a link
Reference in a new issue