-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update modal popup design + update create branch modal
- Loading branch information
Showing
15 changed files
with
496 additions
and
141 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
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 |
---|---|---|
|
@@ -38,6 +38,11 @@ | |
} | ||
} | ||
|
||
&.disabled { | ||
opacity: 0.5; | ||
pointer-events: none; | ||
} | ||
|
||
@include darkTheme { | ||
color: #ccc; | ||
|
||
|
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,22 @@ | ||
.fieldHeader { | ||
display: flex; | ||
align-items: center; | ||
gap: 4px; | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 24px; | ||
padding: 0 4px; | ||
} | ||
|
||
.optional { | ||
opacity: 0.5; | ||
margin-left: 6px; | ||
font-weight: 450; | ||
} | ||
|
||
.headerNote { | ||
color: var(--Grey50, #808080); | ||
font-weight: 400; | ||
margin-left: auto; | ||
} |
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,19 @@ | ||
import styles from "./fieldHeader.module.scss"; | ||
|
||
export interface FieldHeaderProps { | ||
label?: string | JSX.Element; | ||
optional?: boolean; | ||
headerNote?: string; | ||
} | ||
|
||
export function FieldHeader({label, optional, headerNote}: FieldHeaderProps) { | ||
return ( | ||
<div className={styles.fieldHeader}> | ||
{label} | ||
{optional ? <span className={styles.optional}>(optional)</span> : null} | ||
{headerNote ? ( | ||
<span className={styles.headerNote}>{headerNote}</span> | ||
) : null} | ||
</div> | ||
); | ||
} |
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,7 +1,9 @@ | ||
export * from "./button"; | ||
export * from "./checkbox"; | ||
export * from "./textInput"; | ||
export * from "./fieldHeader"; | ||
export * from "./select"; | ||
export * from "./icons"; | ||
export * from "./logos"; | ||
export * from "./infoTooltip"; | ||
export * from "./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,101 @@ | ||
import {HTMLAttributes, PropsWithChildren} from "react"; | ||
|
||
import cn from "@edgedb/common/utils/classNames"; | ||
|
||
import styles from "./modal.module.scss"; | ||
import {CrossIcon, WarningIcon} from "../icons"; | ||
|
||
export interface ModalProps { | ||
className?: string; | ||
title: string; | ||
subheading?: string; | ||
onClose?: () => void; | ||
noCloseOnOverlayClick?: boolean; | ||
onSubmit?: () => void; | ||
formError?: string | null; | ||
footerButtons?: JSX.Element; | ||
footerDetails?: JSX.Element; | ||
footerExtra?: JSX.Element; | ||
} | ||
|
||
export function Modal({ | ||
className, | ||
title, | ||
subheading, | ||
onClose, | ||
noCloseOnOverlayClick, | ||
onSubmit, | ||
formError, | ||
children, | ||
footerDetails, | ||
footerButtons, | ||
footerExtra, | ||
}: PropsWithChildren<ModalProps>) { | ||
const El = onSubmit ? "form" : "div"; | ||
|
||
return ( | ||
<div | ||
className={styles.modalOverlay} | ||
onClick={ | ||
onClose && !noCloseOnOverlayClick | ||
? (e) => { | ||
if (e.target === e.currentTarget) { | ||
onClose(); | ||
} | ||
} | ||
: undefined | ||
} | ||
> | ||
<El | ||
className={cn(styles.modal, className)} | ||
onSubmit={ | ||
onSubmit | ||
? (e) => { | ||
e.preventDefault(); | ||
onSubmit(); | ||
} | ||
: undefined | ||
} | ||
autoComplete="off" | ||
> | ||
<div className={styles.header}> | ||
<div className={styles.headings}> | ||
<div className={styles.title}>{title}</div> | ||
{subheading ? ( | ||
<div className={styles.subheading}>{subheading}</div> | ||
) : null} | ||
</div> | ||
<div | ||
className={styles.closeButton} | ||
onClick={onClose && (() => onClose())} | ||
> | ||
<CrossIcon /> | ||
</div> | ||
</div> | ||
{children} | ||
{formError ? ( | ||
<div className={styles.formError}> | ||
<WarningIcon /> | ||
<div>{formError}</div> | ||
</div> | ||
) : null} | ||
{footerButtons || footerDetails ? ( | ||
<div className={styles.footer}> | ||
{footerExtra} | ||
<div className={styles.footerMain}> | ||
<div className={styles.footerDetails}>{footerDetails}</div> | ||
{footerButtons} | ||
</div> | ||
</div> | ||
) : null} | ||
</El> | ||
</div> | ||
); | ||
} | ||
|
||
export function ModalContent({ | ||
className, | ||
...props | ||
}: PropsWithChildren<HTMLAttributes<HTMLDivElement>>) { | ||
return <div className={cn(styles.content, className)} {...props} />; | ||
} |
Oops, something went wrong.