-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs/update-devtools-folder-structure
- Loading branch information
Showing
13 changed files
with
223 additions
and
29 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
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,76 @@ | ||
import React from 'react' | ||
import {useEffect, useState} from 'react' | ||
import { Tooltip } from 'react-tooltip' | ||
import { useColorMode } from '@docusaurus/theme-common' | ||
import Link from '/src/components/Link'; | ||
|
||
function generateUniqueId(prefix = 'id') { | ||
return `${prefix}-${Math.random().toString(36).substr(2, 9)}`; | ||
} | ||
export const badgeSrc = ({ title, color, logo, logoColor, label, labelColor, version }) => { | ||
if (version) { | ||
title = version | ||
label = label ?? 'version' | ||
color = color ?? 'blue' | ||
} | ||
|
||
let encodedTitle = title ? title.replace(/-/g, '--').replace(/_/g, '__').replace(/ /g, '_') : '' | ||
|
||
const colorsMatch = { | ||
pink: '#FF70E0', | ||
purple: '#9E75FF', | ||
green: '#78C700', | ||
orange: '#FF9100', | ||
cyan: '#08FFD1', | ||
yellow: '#DEFF1A' | ||
} | ||
|
||
color = colorsMatch[color] || color | ||
labelColor = colorsMatch[labelColor] || labelColor || 'gray' | ||
label = label ? `&label=${label}&labelColor=${labelColor}` : '' | ||
|
||
logoColor = colorsMatch[logoColor] || logoColor || 'white' | ||
logo = logo ? `&logo=${logo}&logoColor=${logoColor}` : '' | ||
|
||
return encodeURI( | ||
`https://img.shields.io/badge/${encodedTitle}-${color || 'gray'}?${logo}${label}` | ||
).replace(/#/g, '%23') | ||
} | ||
|
||
function Tag ({ children, href, ...props }) { | ||
return href ? ( | ||
<Link href={href} {...props}> | ||
{children} | ||
</Link> | ||
) : ( | ||
<span {...props}>{children}</span> | ||
) | ||
} | ||
|
||
export default function ShieldsBadge ({ title, color, href, label, labelColor, logo, logoColor, version, tooltip = null, ...props }) { | ||
|
||
const src = badgeSrc({ title, color, logo, logoColor, label, labelColor, version }) | ||
|
||
const tooltipId = tooltip ? generateUniqueId('tooltip') : null; | ||
|
||
const {colorMode} = useColorMode(); | ||
const [toolTipColor, setTooltipColor] = useState('light'); | ||
|
||
useEffect(() => { | ||
if (tooltip) { | ||
setTooltipColor(colorMode === 'light' ? 'dark' : 'light'); | ||
} | ||
}, [colorMode]); | ||
|
||
return src && <> | ||
<Tag href={href || null} {...props} className={`d-inline-flex align-bottom`} | ||
data-tooltip-id={tooltip && tooltipId} | ||
data-tooltip-content={tooltip} | ||
> | ||
<img src={src} alt={title || ''} {...props} /> | ||
{tooltip && ( | ||
<Tooltip id={tooltipId} opacity={0.95} wrapper={"span"} variant={toolTipColor} className="px-8 py-4 fs-12"/> | ||
)} | ||
</Tag> | ||
</> | ||
} |
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 React from 'react' | ||
import Button from '../Button' | ||
import clsx from 'clsx' | ||
import Translate from '@docusaurus/Translate'; | ||
|
||
export const ToTopButton = ({ className }) => { | ||
|
||
return ( | ||
<Button | ||
className={clsx(className)} | ||
size={`sm`} | ||
icon={`arrow-top`} | ||
onClick={() => { | ||
if (window) { | ||
window.scrollTo({ top: 0, behavior: 'smooth' }) | ||
} | ||
}} | ||
> | ||
<Translate | ||
id="theme.common.backToTop"> | ||
Back to top | ||
</Translate> | ||
</Button> | ||
) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1658,6 +1658,26 @@ | |
utility-types "^3.10.0" | ||
webpack "^5.88.1" | ||
|
||
"@floating-ui/core@^1.6.0": | ||
version "1.6.8" | ||
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.8.tgz#aa43561be075815879305965020f492cdb43da12" | ||
integrity sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA== | ||
dependencies: | ||
"@floating-ui/utils" "^0.2.8" | ||
|
||
"@floating-ui/dom@^1.6.1": | ||
version "1.6.12" | ||
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.12.tgz#6333dcb5a8ead3b2bf82f33d6bc410e95f54e556" | ||
integrity sha512-NP83c0HjokcGVEMeoStg317VD9W7eDlGK7457dMBANbKA6GJZdc7rjujdgqzTaz93jkGgc5P/jeWbaCHnMNc+w== | ||
dependencies: | ||
"@floating-ui/core" "^1.6.0" | ||
"@floating-ui/utils" "^0.2.8" | ||
|
||
"@floating-ui/utils@^0.2.8": | ||
version "0.2.8" | ||
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.8.tgz#21a907684723bbbaa5f0974cf7730bd797eb8e62" | ||
integrity sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig== | ||
|
||
"@formspark/use-formspark@^0.1.39": | ||
version "0.1.39" | ||
resolved "https://registry.yarnpkg.com/@formspark/use-formspark/-/use-formspark-0.1.39.tgz#155af2f5f587d754e1541519e3d69691823770a8" | ||
|
@@ -3070,7 +3090,7 @@ ci-info@^3.2.0: | |
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" | ||
integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== | ||
|
||
classnames@^2.3.2: | ||
classnames@^2.3.0, classnames@^2.3.2: | ||
version "2.5.1" | ||
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" | ||
integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== | ||
|
@@ -7169,6 +7189,14 @@ [email protected], react-router@^5.3.4: | |
tiny-invariant "^1.0.2" | ||
tiny-warning "^1.0.0" | ||
|
||
react-tooltip@^5.28.0: | ||
version "5.28.0" | ||
resolved "https://registry.yarnpkg.com/react-tooltip/-/react-tooltip-5.28.0.tgz#c7b5343ab2d740a428494a3d8315515af1f26f46" | ||
integrity sha512-R5cO3JPPXk6FRbBHMO0rI9nkUG/JKfalBSQfZedZYzmqaZQgq7GLzF8vcCWx6IhUCKg0yPqJhXIzmIO5ff15xg== | ||
dependencies: | ||
"@floating-ui/dom" "^1.6.1" | ||
classnames "^2.3.0" | ||
|
||
react-transition-group@^4.4.5: | ||
version "4.4.5" | ||
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.5.tgz#e53d4e3f3344da8521489fbef8f2581d42becdd1" | ||
|