diff --git a/packages/react/components/CopyToClipboardButton/index.mjs b/packages/react/components/CopyToClipboardButton/index.mjs index 3fbc3dba597..8225b70dc62 100644 --- a/packages/react/components/CopyToClipboardButton/index.mjs +++ b/packages/react/components/CopyToClipboardButton/index.mjs @@ -21,29 +21,41 @@ const handleCopied = (content, setCopied, setLoadingStatus, label) => { setTimeout(() => setCopied(false), 1000) } +/** + * A component to copy something to the clipboard + * + * @component + * @param {object} props - All component props + * @param {JSX.element} props.children - The component children + * @param {string} props.content - The content that should be copied to the clipboard + * @param {string} props.label - The label to show when the content is copied + * @param {boolean} props.sup - Set this to true to render as superscript (above the line) + * @returns {JSX.Element} + */ export const CopyToClipboardButton = ({ children, content, label = false, sup = false }) => { const [copied, setCopied] = useState(false) const { setLoadingStatus } = useContext(LoadingStatusContext) - const style = sup ? 'tw:w-4 tw:h-4 tw:-mt-4' : 'tw:w-5 tw:h-5' + const style = sup ? 'tw:w-4 tw:h-4 tw:-mt-4 tw:-ml-1' : 'tw:w-5 tw:h-5' return ( ) } diff --git a/packages/react/mkdocs.sh b/packages/react/mkdocs.sh index bbaf258a8ba..48d2ccaf252 100755 --- a/packages/react/mkdocs.sh +++ b/packages/react/mkdocs.sh @@ -7,3 +7,4 @@ jsdoc -c jsdoc.json components/Breadcrumbs/* > ../../sites/dev/prebuild/jsdoc/re jsdoc -c jsdoc.json components/Button/* > ../../sites/dev/prebuild/jsdoc/react/components/button.json jsdoc -c jsdoc.json components/Collection/* > ../../sites/dev/prebuild/jsdoc/react/components/collection.json jsdoc -c jsdoc.json components/Control/* > ../../sites/dev/prebuild/jsdoc/react/components/control.json +jsdoc -c jsdoc.json components/CopyToClipboardButton/* > ../../sites/dev/prebuild/jsdoc/react/components/copytoclipboardbutton.json diff --git a/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/_examples.js b/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/_examples.js new file mode 100644 index 00000000000..c9701d2badb --- /dev/null +++ b/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/_examples.js @@ -0,0 +1,9 @@ +import React from 'react' +import { CopyToClipboardButton } from '@freesewing/react/components/CopyToClipboardButton' + +export const CopyToClipboardButtonExample = () => ( + <> + Regular Example + Sup Example + +) diff --git a/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/readme.mdx b/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/readme.mdx index 1cfa8a4f079..5be13515688 100644 --- a/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/readme.mdx +++ b/sites/dev/docs/reference/packages/react/components/copytoclipboardbutton/readme.mdx @@ -2,6 +2,20 @@ title: CopyToClipboardButton --- -:::note -This page is yet to be created -::: +import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus' +import { ComponentDocs } from '@site/src/components/component-docs.js' +import { jsdocCopyToClipboardButton } from '@site/prebuild/jsdoc/components.copytoclipboardbutton.mjs' +import { CopyToClipboardButtonExample } from './_examples.js' + + + +The **CopyToClipboardButton** component family provides the following components: + +- [CopyToClipboardButton](#copytoclipboardbutton) + +## CopyToClipboardButton + + + + +