-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace mockup with refactored version
- Loading branch information
1 parent
ca27200
commit 57c4b7e
Showing
2 changed files
with
56 additions
and
35 deletions.
There are no files selected for viewing
56 changes: 32 additions & 24 deletions
56
packages/docs-reanimated/src/components/AvailableFrom/index.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 |
---|---|---|
@@ -1,38 +1,46 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import { useColorMode } from '@docusaurus/theme-common'; | ||
|
||
import styles from './styles.module.css'; | ||
import Danger from '/static/img/danger.svg'; | ||
import DangerDark from '/static/img/danger-dark.svg'; | ||
|
||
interface Props { | ||
version?: string; | ||
big?: any; | ||
isFull?: boolean; | ||
} | ||
|
||
export default function AvailableFrom({ version, big }: Props) { | ||
return ( | ||
<> | ||
{big ? ( | ||
<div className={styles.big}> | ||
<div className={styles.info}> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="13" | ||
height="14" | ||
fill="none" | ||
viewBox="0 0 13 14"> | ||
<path | ||
stroke="#001a72" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M6.5 10.327v.006m0-6.666v4.666M12.5 7a6 6 0 11-12 0 6 6 0 0112 0z"></path> | ||
</svg> | ||
export default function AvailableFrom({ version, isFull }: Props) { | ||
const { colorMode } = useColorMode(); | ||
const isLightMode = colorMode === 'light'; | ||
const badgeThemeStyles = isLightMode ? styles.light : styles.dark; | ||
|
||
const getBadgeContent = () => { | ||
if (isFull) { | ||
return ( | ||
<> | ||
<div className={styles.infoIcon}> | ||
{isLightMode ? <Danger /> : <DangerDark />} | ||
</div> | ||
<span> | ||
Available from Reanimated{' '} | ||
<span className={styles.version}>v{version}</span> | ||
</span> | ||
</div> | ||
) : ( | ||
<div className={styles.badge}>Available from v{version}</div> | ||
)} | ||
</> | ||
</> | ||
); | ||
} | ||
|
||
return <>Available from v{version}</>; | ||
}; | ||
|
||
return ( | ||
<div | ||
className={clsx( | ||
isFull ? styles.fullBadge : styles.badge, | ||
badgeThemeStyles | ||
)}> | ||
{getBadgeContent()} | ||
</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