-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Modal component + use it on ProjectAssetExplorer
- Loading branch information
1 parent
312e425
commit 970a1fe
Showing
17 changed files
with
204 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import React from 'react' | ||
import classNames from 'classnames' | ||
import cx from 'classnames' | ||
|
||
import { PropTypes } from './types' | ||
import './Button.css' | ||
|
||
function Button(props: PropTypes) { | ||
function Button({ size, type, ...props }: PropTypes) { | ||
return ( | ||
<button {...props} className={classNames('Button', props.className)}> | ||
<button {...props} className={cx('Button', size, type, props.className)}> | ||
{props.children} | ||
</button> | ||
) | ||
} | ||
|
||
export default Button | ||
export default Button |
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
export type PropTypes = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> | ||
type Button = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> | ||
|
||
export type PropTypes = Omit<Button, 'type' | 'size'> & { | ||
type?: 'danger' | 'etc' | ||
size?: 'big' | 'etc' | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.Modal { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
margin-right: -50%; | ||
transform: translate(-50%, -50%); | ||
border: 1px solid var(--modal-content-border-color); | ||
background: var(--modal-content-bg-color); | ||
overflow: auto; | ||
border-radius: 3px; | ||
outline: none; | ||
padding: 20px; | ||
min-width: 500px; | ||
min-height: 200px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
.ModalOverlay { | ||
position: fixed; | ||
inset: 0px; | ||
background-color: var(--modal-overlay-bg-color); | ||
} |
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,26 @@ | ||
import React from 'react' | ||
import _Modal from 'react-modal' | ||
|
||
import { Props } from './types' | ||
|
||
import './Modal.css' | ||
|
||
const Modal = ({ | ||
children, | ||
className = '', | ||
overlayClassName = '', | ||
...props | ||
}: Props) => { | ||
return ( | ||
<_Modal | ||
ariaHideApp={false} | ||
className={`${className} Modal`} | ||
overlayClassName={`${overlayClassName} ModalOverlay`} | ||
{...props} | ||
> | ||
{children} | ||
</_Modal> | ||
) | ||
} | ||
|
||
export default React.memo(Modal) |
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,2 @@ | ||
import Modal from './Modal' | ||
export { Modal } |
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,4 @@ | ||
import React from 'react' | ||
import Modal from 'react-modal' | ||
|
||
export type Props = React.PropsWithChildren<Modal.Props> |
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 |
---|---|---|
|
@@ -18,4 +18,8 @@ | |
|
||
.ProjectView .with-context-menu { | ||
height: 100%; | ||
} | ||
} | ||
|
||
.RemoveAsset.Modal > div button { | ||
margin-right: 12px; | ||
} |
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.