-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rebrand' into 463/rebrand-proposal-details
- Loading branch information
Showing
30 changed files
with
699 additions
and
256 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 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
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,36 @@ | ||
@import '../../../styles/fonts.module.scss'; | ||
|
||
@mixin link-gray { | ||
color: $color-gray-700; | ||
height: 20px; | ||
border: none; | ||
|
||
&.xs { | ||
@include font-overline-2; | ||
} | ||
|
||
&.sm { | ||
@include font-link-3; | ||
} | ||
|
||
&.md { | ||
@include font-link-2; | ||
} | ||
|
||
&.lg { | ||
height: 24px; | ||
@include font-link-1; | ||
} | ||
|
||
&:hover { | ||
color: $color-green-800; | ||
} | ||
|
||
&:active { | ||
color: $color-green-700; | ||
} | ||
|
||
&:disabled { | ||
color: $color-gray-400; | ||
} | ||
} |
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,123 @@ | ||
@import '../../styles/variables.module.scss'; | ||
@import '../../styles/fonts.module.scss'; | ||
|
||
.checkbox { | ||
display: flex; | ||
align-items: flex-start; | ||
gap: 8px; | ||
|
||
&, | ||
* { | ||
cursor: pointer; | ||
transition: all 0.1s; | ||
} | ||
|
||
.checkmark { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
min-height: 16px; | ||
min-width: 16px; | ||
height: 16px; | ||
width: 16px; | ||
background-color: $color-gray-50; | ||
border: 1px solid $color-dark-blue-50; | ||
border-radius: 2px; | ||
margin-top: 2px; | ||
|
||
svg { | ||
margin: auto; | ||
width: 12px; | ||
height: 12px; | ||
color: $color-gray-50; | ||
} | ||
} | ||
|
||
.checkboxTextBlock { | ||
display: flex; | ||
flex-direction: column; | ||
@include font-body-12; | ||
|
||
label { | ||
color: $color-dark-blue-800; | ||
} | ||
|
||
.description { | ||
color: $color-gray-500; | ||
} | ||
} | ||
|
||
&[aria-checked='true'] { | ||
.checkmark { | ||
background-color: $color-dark-blue-400; | ||
border-color: $color-gray-50; | ||
} | ||
} | ||
|
||
&:hover:not([aria-disabled='true']) { | ||
.checkmark { | ||
background-color: $color-base-light; | ||
border-color: $color-dark-blue-400; | ||
|
||
svg { | ||
color: $color-dark-blue-400; | ||
} | ||
} | ||
|
||
.checkboxTextBlock { | ||
label { | ||
color: $color-gray-900; | ||
} | ||
|
||
.description { | ||
color: $color-gray-600; | ||
} | ||
} | ||
} | ||
|
||
&[aria-disabled='true'] { | ||
pointer-events: none; | ||
|
||
.checkmark { | ||
background-color: transparent; | ||
border-color: $color-gray-200; | ||
|
||
svg { | ||
color: $color-gray-200; | ||
} | ||
} | ||
|
||
.checkboxTextBlock { | ||
label { | ||
color: $color-gray-400; | ||
} | ||
|
||
.description { | ||
color: $color-gray-200; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media (min-width: $sm) { | ||
.checkbox { | ||
gap: 12px; | ||
|
||
.checkmark { | ||
min-height: 20px; | ||
min-width: 20px; | ||
height: 20px; | ||
width: 20px; | ||
margin-top: 2px; | ||
|
||
svg { | ||
width: 16px; | ||
height: 16px; | ||
} | ||
} | ||
|
||
.checkboxTextBlock { | ||
@include font-body-9; | ||
} | ||
} | ||
} |
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,44 @@ | ||
import { KeyboardEvent, ReactNode } from 'react'; | ||
import { CheckIcon } from '../icons'; | ||
import styles from './checkbox.module.scss'; | ||
|
||
interface Props { | ||
label?: string; | ||
checked: boolean; | ||
children?: ReactNode; | ||
disabled?: boolean; | ||
onChange: (checked: boolean) => void; | ||
} | ||
|
||
const CheckBox = ({ label, checked, children, disabled, onChange }: Props) => { | ||
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => { | ||
if (event.key === 'Enter' || event.key === ' ') { | ||
event.preventDefault(); | ||
onChange(!checked); | ||
} | ||
}; | ||
|
||
return ( | ||
<div | ||
id={label} | ||
className={styles.checkbox} | ||
tabIndex={0} | ||
role="checkbox" | ||
aria-checked={checked} | ||
aria-disabled={disabled} | ||
onClick={() => { | ||
onChange(!checked); | ||
}} | ||
onKeyDown={handleKeyDown} | ||
> | ||
<span className={styles.checkmark}>{checked && <CheckIcon />}</span> | ||
|
||
<div className={styles.checkboxTextBlock}> | ||
<label htmlFor={label}>{label}</label> | ||
{children && <div className={styles.description}>{children}</div>} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CheckBox; |
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 @@ | ||
export { default } from './checkbox'; | ||
export * from './checkbox'; |
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,32 +1,37 @@ | ||
import { ReactNode, useEffect } from 'react'; | ||
import { ComponentPropsWithoutRef, useEffect } from 'react'; | ||
|
||
interface Props { | ||
className?: string; | ||
interface Props extends Omit<ComponentPropsWithoutRef<'a'>, 'target' | 'rel'> { | ||
href: string; | ||
children: ReactNode; | ||
} | ||
|
||
const ExternalLink = (props: Props) => { | ||
const { className, children } = props; | ||
const { children, href: incomingHref, ...rest } = props; | ||
|
||
let href = props.href.trim(); | ||
const urlRegex = /^https?:\/\//i; // Starts with https:// or http:// (case insensitive) | ||
if (!urlRegex.test(href)) { | ||
href = 'about:blank'; | ||
} | ||
const href = cleanHref(incomingHref); | ||
|
||
useEffect(() => { | ||
if (process.env.NODE_ENV === 'development' && href === 'about:blank') { | ||
// eslint-disable-next-line no-console | ||
console.warn(`An invalid URL has been provided: "${props.href}". Only https:// or http:// URLs are allowed.`); | ||
console.warn(`An invalid URL has been provided: "${incomingHref}". Only https:// or http:// URLs are allowed.`); | ||
} | ||
}, [href, props.href]); | ||
}, [href, incomingHref]); | ||
|
||
return ( | ||
<a href={href} className={className} target="_blank" rel="noopener noreferrer"> | ||
<a target="_blank" rel="noopener noreferrer" href={href} {...rest}> | ||
{children} | ||
</a> | ||
); | ||
}; | ||
|
||
const cleanHref = (href: string) => { | ||
const urlRegex = /^https?:\/\//i; // Starts with https:// or http:// (case insensitive) | ||
const trimmedHref = href.trim(); | ||
|
||
if (!urlRegex.test(trimmedHref)) { | ||
return 'about:blank'; | ||
} | ||
|
||
return trimmedHref; | ||
}; | ||
|
||
export default ExternalLink; |
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,15 @@ | ||
import { ComponentProps } from 'react'; | ||
|
||
export const CheckIcon = (props: ComponentProps<'svg'>) => { | ||
return ( | ||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}> | ||
<path | ||
d="M13 4.25L6.125 11.125L3 8" | ||
stroke="currentColor" | ||
strokeWidth="1.25" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
); | ||
}; |
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.