-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64047c0
commit 2d5146a
Showing
8 changed files
with
109 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Fragment, FunctionComponent, h } from 'preact' | ||
import { RouterLink } from '~/ui/router' | ||
import { docLink } from '~/ui/router/docLink' | ||
import { parseMajorVersion } from '~/utils/docs' | ||
import * as styles from './styles.css' | ||
|
||
interface Props { | ||
name: string | ||
pure: boolean | undefined | ||
selectedVersion: string | ||
hasOptions: boolean | ||
} | ||
|
||
export const FP: FunctionComponent<Props> = ({ | ||
name, | ||
pure, | ||
selectedVersion, | ||
hasOptions, | ||
}) => { | ||
const version = selectedVersion && parseMajorVersion(selectedVersion) | ||
if (!version || version < 3) return null | ||
|
||
return pure ? ( | ||
<div class={styles.fpNote}> | ||
🦄 The function is also available in the FP submodule as{' '} | ||
<code>{name}</code> | ||
{hasOptions && ( | ||
<Fragment> | ||
{' '} | ||
and <code>{name}WithOptions</code> | ||
</Fragment> | ||
)} | ||
.{' '} | ||
<RouterLink | ||
decorated | ||
to={docLink({ | ||
page: 'FP-Guide', | ||
version: selectedVersion, | ||
})} | ||
> | ||
Read more about it in the FP guide | ||
</RouterLink> | ||
. | ||
</div> | ||
) : ( | ||
<div class={styles.fpNote}> | ||
⚠️ Please note that this function is not present in the FP submodule as it | ||
uses <code>Date.now()</code> internally hence impure and can't be safely | ||
curried. | ||
</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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { globalStyle, style } from '@vanilla-extract/css' | ||
|
||
export const fpNote = style({ | ||
marginTop: '0.75rem', | ||
fontSize: '14px', | ||
color: '#7c6973', | ||
|
||
'@media': { | ||
'(prefers-color-scheme: dark)': { | ||
color: '#9b838f', | ||
}, | ||
}, | ||
}) | ||
|
||
globalStyle(`${fpNote} code`, { | ||
border: '1px solid #5844521a', | ||
background: '#fffefd', | ||
|
||
'@media': { | ||
'(prefers-color-scheme: dark)': { | ||
borderColor: '#2c1622', | ||
background: '#12000a', | ||
}, | ||
}, | ||
}) |
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