-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Markdown editing and rendering support for Circulars
This is currently hidden behind a feature flag until we have documentation and announcements for it.
- Loading branch information
Showing
19 changed files
with
817 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
} | ||
|
||
& pre, | ||
&code { | ||
& code { | ||
margin: 0; | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
app/routes/_gcn.circulars.edit.$circularId/RichEditor/GitLabIcon.module.scss
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 @@ | ||
/*! | ||
* Copyright © 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
.icon { | ||
display: inline-block; | ||
color: inherit; | ||
background-color: currentcolor; | ||
mask-position: center; | ||
mask-repeat: no-repeat; | ||
} |
28 changes: 28 additions & 0 deletions
28
app/routes/_gcn.circulars.edit.$circularId/RichEditor/GitLabIcon.tsx
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 @@ | ||
/*! | ||
* Copyright © 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import classNames from 'classnames' | ||
|
||
import styles from './GitLabIcon.module.css' | ||
|
||
export function GitLabIcon({ | ||
src, | ||
className, | ||
style, | ||
...props | ||
}: { src: string } & JSX.IntrinsicElements['span']) { | ||
return ( | ||
<span | ||
style={{ | ||
maskImage: `url(${src})`, | ||
...style, | ||
}} | ||
className={classNames(styles.icon, className)} | ||
{...props} | ||
/> | ||
) | ||
} |
35 changes: 35 additions & 0 deletions
35
app/routes/_gcn.circulars.edit.$circularId/RichEditor/Tabs.module.scss
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,35 @@ | ||
/*! | ||
* Copyright © 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
.tabs { | ||
:global(.usa-button-group__item) { | ||
:global(.usa-button) { | ||
box-shadow: 0px 0px 0px 0px; | ||
border-bottom-left-radius: 0; | ||
border-bottom-right-radius: 0; | ||
border: 2px solid; | ||
padding-bottom: 14px; | ||
width: auto; | ||
|
||
&:not(.checked) { | ||
margin-top: 2px; | ||
} | ||
|
||
&.checked { | ||
padding-top: 14px; | ||
border-top-left-radius: 4px; | ||
border-top-right-radius: 4px; | ||
border-bottom-color: transparent; | ||
} | ||
} | ||
|
||
&:last-child :global(.usa-button) { | ||
margin-left: -1px; | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
app/routes/_gcn.circulars.edit.$circularId/RichEditor/Tabs.tsx
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,52 @@ | ||
/*! | ||
* Copyright © 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { Button, ButtonGroup } from '@trussworks/react-uswds' | ||
import classNames from 'classnames' | ||
import { type ReactElement } from 'react' | ||
|
||
import { ExclusiveOptionGroup, useExclusiveOption } from './exclusiveGroup' | ||
|
||
import styles from './Tabs.module.css' | ||
|
||
export function Tab({ | ||
defaultChecked, | ||
className, | ||
onClick, | ||
...props | ||
}: { defaultSelected?: boolean } & Omit< | ||
Parameters<typeof Button>[0], | ||
'outline' | 'type' | ||
>) { | ||
const [checked, setChecked] = useExclusiveOption(defaultChecked) | ||
return ( | ||
<Button | ||
outline | ||
type="button" | ||
className={classNames(className, { [styles.checked]: checked })} | ||
onClick={(e) => { | ||
setChecked() | ||
onClick?.(e) | ||
}} | ||
{...props} | ||
/> | ||
) | ||
} | ||
|
||
export function TabBar({ | ||
children, | ||
}: { | ||
children: Iterable<ReactElement<typeof Tab>> | ||
}) { | ||
return ( | ||
<ExclusiveOptionGroup> | ||
<ButtonGroup type="segmented" className={styles.tabs}> | ||
{children} | ||
</ButtonGroup> | ||
</ExclusiveOptionGroup> | ||
) | ||
} |
Oops, something went wrong.