[react] feat: Added docs for components/Account
This commit is contained in:
parent
f5a089f884
commit
6d9cbf55c2
37 changed files with 665 additions and 277 deletions
|
@ -48,11 +48,13 @@ const fields = {
|
||||||
expiresAt: 'Expires',
|
expiresAt: 'Expires',
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/apikeys page
|
* A component to mange the user's API keys
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {function} Link - A framework specific Link component for client-side routing
|
* @param {object} props - All component props
|
||||||
|
* @param {JSX.Element} [props.Link] - An optional framework-specific Link component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Apikeys = ({ Link = false }) => {
|
export const Apikeys = ({ Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -17,12 +17,14 @@ import { PassiveImageInput } from '@freesewing/react/components/Input'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { WelcomeIcons } from './shared.mjs'
|
import { WelcomeIcons } from './shared.mjs'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/bio page
|
* Component to manage the user's Avatar
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
* @params {function} props.Link - A framework specific Link component for client-side routing
|
* @param {boolean} [props.welcome = false] - Set to true to render the welcome/onboarding flow
|
||||||
|
* @param {function} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Avatar = ({ welcome = false, Link = false }) => {
|
export const Avatar = ({ welcome = false, Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
@ -98,7 +100,7 @@ export const Avatar = ({ welcome = false, Link = false }) => {
|
||||||
<>
|
<>
|
||||||
<p className="tw:text-right">
|
<p className="tw:text-right">
|
||||||
<button
|
<button
|
||||||
className="tw:daisy-btn tw:daisy-btn-primary tw:w-full tw:lg:w-auto mt-8"
|
className="tw:daisy-btn tw:daisy-btn-primary tw:w-full tw:lg:w-auto tw:mt-4"
|
||||||
onClick={save}
|
onClick={save}
|
||||||
>
|
>
|
||||||
<SaveIcon /> Save Avatar
|
<SaveIcon /> Save Avatar
|
||||||
|
|
|
@ -16,12 +16,14 @@ import { MarkdownInput } from '@freesewing/react/components/Input'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { WelcomeIcons } from './shared.mjs'
|
import { WelcomeIcons } from './shared.mjs'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/bio page
|
* Component to manage the user's Bio
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
* @params {function} props.Link - A framework specific Link component for client-side routing
|
* @param {boolean} [props.welcome = false] - Set to true to render the welcome/onboarding flow
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Bio = ({ welcome = false, Link = false }) => {
|
export const Bio = ({ welcome = false, Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -25,7 +25,10 @@ const types = {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for the account/bookmarks page
|
* A component to manage the user's bookmarks
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Bookmarks = () => {
|
export const Bookmarks = () => {
|
||||||
// Hooks & Context
|
// Hooks & Context
|
||||||
|
@ -178,7 +181,7 @@ export const Bookmarks = () => {
|
||||||
* @param {object} props - All the React props
|
* @param {object} props - All the React props
|
||||||
* @param {function} onCreated - An optional method to call when the bookmark is created
|
* @param {function} onCreated - An optional method to call when the bookmark is created
|
||||||
*/
|
*/
|
||||||
export const NewBookmark = ({ onCreated = false }) => {
|
const NewBookmark = ({ onCreated = false }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
||||||
const { clearModal } = useContext(ModalContext)
|
const { clearModal } = useContext(ModalContext)
|
||||||
|
@ -242,13 +245,15 @@ export const NewBookmark = ({ onCreated = false }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* A component to add a bookmark from wherever
|
* Component to add a bookmark to the user's account
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {string} props.href - The bookmark href
|
* @param {object} props - All component props
|
||||||
* @params {string} props.title - The bookmark title
|
* @param {string} props.slug - The bookmark slug/href
|
||||||
* @params {string} props.type - The bookmark type
|
* @param {string} props.title - The bookmark title
|
||||||
|
* @param {string} props.type - The bookmark type, one of design, pattern, set, cset, doc, or custom
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const BookmarkButton = ({ slug, type, title }) => {
|
export const BookmarkButton = ({ slug, type, title }) => {
|
||||||
const { setModal } = useContext(ModalContext)
|
const { setModal } = useContext(ModalContext)
|
||||||
|
@ -274,19 +279,22 @@ export const BookmarkButton = ({ slug, type, title }) => {
|
||||||
/*
|
/*
|
||||||
* A component to create a bookmark, preloaded with props
|
* A component to create a bookmark, preloaded with props
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {string} props.href - The bookmark href
|
* @param {object} props - All component props
|
||||||
* @params {string} props.title - The bookmark title
|
* @param {string} props.href - The bookmark href
|
||||||
* @params {string} props.type - The bookmark type
|
* @param {string} props.title - The bookmark title
|
||||||
*
|
* @param {string} props.type - The bookmark type
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const CreateBookmark = ({ type, title, slug }) => {
|
const CreateBookmark = ({ type, title, slug }) => {
|
||||||
const backend = useBackend()
|
const backend = useBackend()
|
||||||
const [name, setName] = useState(title)
|
const [name, setName] = useState(title)
|
||||||
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
||||||
const { setModal } = useContext(ModalContext)
|
const { setModal } = useContext(ModalContext)
|
||||||
|
|
||||||
const url = `/${slug}`
|
const url = slug.toLowerCase().slice(0,4) === 'http'
|
||||||
|
? slug
|
||||||
|
: `/${slug}`
|
||||||
|
|
||||||
const bookmark = async (evt) => {
|
const bookmark = async (evt) => {
|
||||||
evt.stopPropagation()
|
evt.stopPropagation()
|
||||||
|
|
|
@ -31,11 +31,12 @@ const strings = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/preferences/compare page
|
* A component to manage the user's compare setting
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @params {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Compare = ({ welcome = false }) => {
|
export const Compare = ({ welcome = false }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -31,12 +31,14 @@ const strings = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/preferences/consent page
|
* A component to manage the user's consent setting
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.signUp - Set to true to use this component on the initial signUp
|
* @param {object} props - All component props
|
||||||
* @param {function} props.Link - An optional framework-specific Link component
|
* @param {bool} [props.signUp = false] - Set to true to use this component on the initial signUp
|
||||||
|
* @param {function} [props.Link = false] - An optional framework-specific Link component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Consent = ({ signUp = false, Link = false, title = false }) => {
|
export const Consent = ({ signUp = false, Link = false, title = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -34,11 +34,13 @@ const strings = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/preferences/control page
|
* A component to manage the user's control/UX setting
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
|
* @param {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Control = ({ welcome = false }) => {
|
export const Control = ({ welcome = false }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -17,12 +17,14 @@ import { EmailInput } from '@freesewing/react/components/Input'
|
||||||
import { Popout } from '@freesewing/react/components/Popout'
|
import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { Spinner } from '@freesewing/react/components/Spinner'
|
import { Spinner } from '@freesewing/react/components/Spinner'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/bio page
|
* A component to manage the user's email address
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
* @params {function} props.Link - A framework specific Link component for client-side routing
|
* @param {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Email = ({ welcome = false, Link = false }) => {
|
export const Email = ({ welcome = false, Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
@ -87,6 +89,14 @@ export const Email = ({ welcome = false, Link = false }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to render the confirmation after changing the user's email
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {function} [props.onSuccess = false] - A method to call after the email is changed
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const EmailChangeConfirmation = ({ onSuccess = false }) => {
|
export const EmailChangeConfirmation = ({ onSuccess = false }) => {
|
||||||
// State
|
// State
|
||||||
const [error, setError] = useState(false)
|
const [error, setError] = useState(false)
|
||||||
|
@ -150,7 +160,7 @@ export const EmailChangeConfirmation = ({ onSuccess = false }) => {
|
||||||
if (!id || !check)
|
if (!id || !check)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1>One moment pleae</h1>
|
<h1>One moment please</h1>
|
||||||
<Spinner className="tw:w-8 tw:h-8 tw:m-auto tw:animate-spin" />
|
<Spinner className="tw:w-8 tw:h-8 tw:m-auto tw:animate-spin" />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,8 +12,11 @@ import { DownloadIcon } from '@freesewing/react/components/Icon'
|
||||||
import { Popout } from '@freesewing/react/components/Popout'
|
import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/actions/export page
|
* A component to manage the user's export account data action
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Export = () => {
|
export const Export = () => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -10,8 +10,11 @@ import { useBackend } from '@freesewing/react/hooks/useBackend'
|
||||||
import { SaveIcon } from '@freesewing/react/components/Icon'
|
import { SaveIcon } from '@freesewing/react/components/Icon'
|
||||||
import { StringInput } from '@freesewing/react/components/Input'
|
import { StringInput } from '@freesewing/react/components/Input'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/social/github page
|
* A component to manage the user's Github handle in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Github = () => {
|
export const Github = () => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -5,11 +5,13 @@ import { useAccount } from '@freesewing/react/hooks/useAccount'
|
||||||
// Components
|
// Components
|
||||||
import { Link as WebLink } from '@freesewing/react/components/Link'
|
import { Link as WebLink } from '@freesewing/react/components/Link'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component to display a user ID
|
* A component to display the user's ID
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {function} props.Link - A framework specific Link component for client-side routing
|
* @param {object} props - All component props
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const UserId = ({ Link = false }) => {
|
export const UserId = ({ Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -13,12 +13,11 @@ import { FileInput } from '@freesewing/react/components/Input'
|
||||||
import { Popout } from '@freesewing/react/components/Popout'
|
import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { Yaml } from '@freesewing/react/components/Yaml'
|
import { Yaml } from '@freesewing/react/components/Yaml'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/bio page
|
* A component to manage the importing of a measurements set into a user's account data
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @returns {JSX.Element}
|
||||||
* @params {function} props.Link - A framework specific Link component for client-side routing
|
|
||||||
*/
|
*/
|
||||||
export const ImportSet = () => {
|
export const ImportSet = () => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
// Context
|
|
||||||
import { LoadingStatusContext } from '@freesewing/react/context/LoadingStatus'
|
|
||||||
|
|
||||||
// Hooks
|
|
||||||
import React, { useState, useContext } from 'react'
|
|
||||||
import { useAccount } from '@freesewing/react/hooks/useAccount'
|
|
||||||
import { useBackend } from '@freesewing/react/hooks/useBackend'
|
|
||||||
|
|
||||||
// Components
|
|
||||||
import { SaveIcon } from '@freesewing/react/components/Icon'
|
|
||||||
import { StringInput } from '@freesewing/react/components/Input'
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Component for the account/social/github page
|
|
||||||
*/
|
|
||||||
export const Instagram = () => {
|
|
||||||
// Hooks
|
|
||||||
const { account, setAccount } = useAccount()
|
|
||||||
const backend = useBackend()
|
|
||||||
const { setLoadingStatus } = useContext(LoadingStatusContext)
|
|
||||||
|
|
||||||
// State
|
|
||||||
const [githubUsername, setGithubUsername] = useState(account.data.githubUsername || '')
|
|
||||||
const [githubEmail, setGithubEmail] = useState(account.data.githubEmail || '')
|
|
||||||
|
|
||||||
// Helper method to save changes
|
|
||||||
const save = async () => {
|
|
||||||
setLoadingStatus([true, 'Saving bio'])
|
|
||||||
const [status, body] = await backend.updateAccount({ data: { githubUsername, githubEmail } })
|
|
||||||
if (status === 200 && body.result === 'success') {
|
|
||||||
setAccount(body.account)
|
|
||||||
setLoadingStatus([true, 'GitHub info updated', true, true])
|
|
||||||
} else setLoadingStatus([true, 'Something went wrong. Please report this', true, true])
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="tw:w-full">
|
|
||||||
<StringInput
|
|
||||||
id="account-github-email"
|
|
||||||
label="GitHub Email Address"
|
|
||||||
current={githubEmail}
|
|
||||||
update={setGithubEmail}
|
|
||||||
valid={(val) => val.length > 0}
|
|
||||||
placeholder={'joost@joost.at'}
|
|
||||||
/>
|
|
||||||
<StringInput
|
|
||||||
id="account-github-username"
|
|
||||||
label="GitHub Username"
|
|
||||||
current={githubUsername}
|
|
||||||
update={setGithubUsername}
|
|
||||||
valid={(val) => val.length > 0}
|
|
||||||
placeholder={'joostdecock'}
|
|
||||||
/>
|
|
||||||
<p className="tw:text-right">
|
|
||||||
<button
|
|
||||||
className="tw:daisy-btn tw:daisy-btn-primary tw:w-full tw:lg:w-auto tw:mt-8"
|
|
||||||
onClick={save}
|
|
||||||
>
|
|
||||||
<SaveIcon /> Save
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -6,7 +6,7 @@ import React, { useState, useEffect } from 'react'
|
||||||
import { useAccount } from '@freesewing/react/hooks/useAccount'
|
import { useAccount } from '@freesewing/react/hooks/useAccount'
|
||||||
import { useBackend } from '@freesewing/react/hooks/useBackend'
|
import { useBackend } from '@freesewing/react/hooks/useBackend'
|
||||||
// Components
|
// Components
|
||||||
import { Link as DefautLink } from '@freesewing/react/components/Link'
|
import { Link as DefaultLink } from '@freesewing/react/components/Link'
|
||||||
import { ControlScore } from '@freesewing/react/components/Control'
|
import { ControlScore } from '@freesewing/react/components/Control'
|
||||||
import {
|
import {
|
||||||
MeasurementsSetIcon,
|
MeasurementsSetIcon,
|
||||||
|
@ -96,10 +96,12 @@ const YesNo = ({ check }) => (check ? <BoolYesIcon /> : <BoolNoIcon />)
|
||||||
const t = (input) => input
|
const t = (input) => input
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Links component shows all of the links to manage your account
|
* A component to manage the user's Instagram handle in their account data
|
||||||
*
|
*
|
||||||
* @param {object} props - All the React props
|
* @component
|
||||||
* @param {function} Link - A custom Link component, typically the Docusaurus one, but it's optional
|
* @param {object} props - All component props
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Links = ({ Link = false }) => {
|
export const Links = ({ Link = false }) => {
|
||||||
// Use custom Link component if available
|
// Use custom Link component if available
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { welcomeSteps } from './shared.mjs'
|
|
||||||
import { horFlexClasses } from '@freesewing/utils'
|
import { horFlexClasses } from '@freesewing/utils'
|
||||||
|
|
||||||
// Context
|
// Context
|
||||||
|
@ -18,13 +17,15 @@ import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { NumberCircle } from '@freesewing/react/components/Number'
|
import { NumberCircle } from '@freesewing/react/components/Number'
|
||||||
import { CopyToClipboardButton } from '@freesewing/react/components/CopyToClipboardButton'
|
import { CopyToClipboardButton } from '@freesewing/react/components/CopyToClipboardButton'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/security/password page
|
* A component to manage the user's MFA settings
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
|
* @param {string} [props.title = false] - Whether or not to display a title
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Mfa = ({ welcome = false, title = true }) => {
|
export const Mfa = ({ title = true }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
const backend = useBackend()
|
const backend = useBackend()
|
||||||
const { account, setAccount } = useAccount()
|
const { account, setAccount } = useAccount()
|
||||||
|
|
|
@ -18,12 +18,14 @@ import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { WelcomeIcons } from './shared.mjs'
|
import { WelcomeIcons } from './shared.mjs'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/preferences/newsletter page
|
* A component to manage the user's newsletter subscription in their account data
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @params {object} props - All Component props
|
||||||
* @param {function} props.Link - An optional framework-specific Link component
|
* @param {bool} props.welcome - Set to true to use this component on the welcome page
|
||||||
|
* @param {React.Component} props.Link - An optional framework-specific Link component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Newsletter = ({ welcome = false, Link = false }) => {
|
export const Newsletter = ({ welcome = false, Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -16,11 +16,14 @@ import { RightIcon, SaveIcon } from '@freesewing/react/components/Icon'
|
||||||
import { PasswordInput } from '@freesewing/react/components/Input'
|
import { PasswordInput } from '@freesewing/react/components/Input'
|
||||||
import { Popout } from '@freesewing/react/components/Popout'
|
import { Popout } from '@freesewing/react/components/Popout'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/security/password page
|
* A component to manage the user's password
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
|
* @param {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Password = ({ welcome = false, Link = false }) => {
|
export const Password = ({ welcome = false, Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -48,6 +48,15 @@ import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
||||||
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage a pattern in the user's account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {number} props.id - The pattern ID to load
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Pattern = ({ id, Link }) => {
|
export const Pattern = ({ id, Link }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
// Hooks
|
// Hooks
|
||||||
|
@ -254,6 +263,21 @@ export const Pattern = ({ id, Link }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to display a card representing a pattern in the user's account data.
|
||||||
|
*
|
||||||
|
* This is a pure render component, you have to pass in the data.
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @param {string} [props.href = false] - An optional URL the pattern card should link to
|
||||||
|
* @param {function} [props.onClick = false] - An optional onClick handler
|
||||||
|
* @param {object} props.pattern - An object holding the pattern data
|
||||||
|
* @param {string} [props.size = 'md'] - The size, one of lg, md, sm, or xs
|
||||||
|
* @param {boolean} [props.useA = false] - Whether to use an a tag of Link component when passing in a href prop
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const PatternCard = ({
|
export const PatternCard = ({
|
||||||
pattern,
|
pattern,
|
||||||
href = false,
|
href = false,
|
||||||
|
@ -265,7 +289,7 @@ export const PatternCard = ({
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
const sizes = {
|
const sizes = {
|
||||||
lg: 96,
|
lg: 96,
|
||||||
md: 52,
|
md: 48,
|
||||||
sm: 36,
|
sm: 36,
|
||||||
xs: 20,
|
xs: 20,
|
||||||
}
|
}
|
||||||
|
@ -315,9 +339,9 @@ export const PatternCard = ({
|
||||||
const BadgeLink = ({ label, href }) => (
|
const BadgeLink = ({ label, href }) => (
|
||||||
<a
|
<a
|
||||||
href={href}
|
href={href}
|
||||||
className="tw:daisy-badge tw:daisy-badge-secondary tw:font-bold tw:daisy-badge-lg tw:hover:text-secondary-content tw:hover:no-underline"
|
className="tw:daisy-badge tw:daisy-badge-secondary tw:font-bold tw:daisy-badge-lg tw:hover:text-secondary-content tw:hover:cursor-pointer"
|
||||||
>
|
>
|
||||||
{label}
|
<span className="tw:text-secondary-content hover:tw:decoration-0">{label}</span>
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,13 @@ const t = (input) => {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/patterns page
|
* A component to display and manage the list of patterns in the user's account
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {function} Link - A framework specific Link component for client-side routing
|
* @param {object} props - All component props
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Patterns = ({ Link = false }) => {
|
export const Patterns = ({ Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
@ -101,8 +103,8 @@ export const Patterns = ({ Link = false }) => {
|
||||||
className="tw:daisy-btn tw:daisy-btn-primary tw:capitalize tw:w-full tw:md:w-auto tw:hover:text-primary-content"
|
className="tw:daisy-btn tw:daisy-btn-primary tw:capitalize tw:w-full tw:md:w-auto tw:hover:text-primary-content"
|
||||||
href="/editor/"
|
href="/editor/"
|
||||||
>
|
>
|
||||||
<PlusIcon />
|
<span className="tw:text-primary-content"><PlusIcon /></span>
|
||||||
Create a new pattern
|
<span className="tw:text-primary-content">Create a new pattern</span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<TableWrapper>
|
<TableWrapper>
|
||||||
|
|
|
@ -19,11 +19,52 @@ const labels = {
|
||||||
website: 'Website',
|
website: 'Website',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage the user's Instagram handle in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Instagram = () => <Platform platform="instagram" />
|
export const Instagram = () => <Platform platform="instagram" />
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage the user's Mastodon handle in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Mastodon = () => <Platform platform="mastodon" />
|
export const Mastodon = () => <Platform platform="mastodon" />
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage the user's Reddit handle in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Reddit = () => <Platform platform="reddit" />
|
export const Reddit = () => <Platform platform="reddit" />
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage the user's Twitch handle in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Twitch = () => <Platform platform="twitch" />
|
export const Twitch = () => <Platform platform="twitch" />
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage the user's Tiktok handle in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Tiktok = () => <Platform platform="tiktok" />
|
export const Tiktok = () => <Platform platform="tiktok" />
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to manage the user's website URL in their account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const Website = () => <Platform platform="website" />
|
export const Website = () => <Platform platform="website" />
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -12,8 +12,11 @@ import { ReloadIcon } from '@freesewing/react/components/Icon'
|
||||||
import { Popout } from '@freesewing/react/components/Popout'
|
import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/actions/export page
|
* A component handle a reload of the account data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Reload = () => {
|
export const Reload = () => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -16,8 +16,11 @@ import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/actions/remove page
|
* A component to handle the removal of a user's account
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Remove = () => {
|
export const Remove = () => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -17,8 +17,13 @@ import { Popout } from '@freesewing/react/components/Popout'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/actions/restrict page
|
* A component to manage the user's options to restrict processing of their data
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Restrict = ({ Link = false }) => {
|
export const Restrict = ({ Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
@ -46,7 +51,7 @@ export const Restrict = ({ Link = false }) => {
|
||||||
<>
|
<>
|
||||||
<p>This button is red for a reason.</p>
|
<p>This button is red for a reason.</p>
|
||||||
<IconButton onClick={restrictAccount} color="error">
|
<IconButton onClick={restrictAccount} color="error">
|
||||||
<Nocon />
|
<NoIcon />
|
||||||
Remove your FreeSewing account
|
Remove your FreeSewing account
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to display the user's role
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {string} props.role - The user role, either user or admin
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const UserRole = ({ role }) => {
|
export const UserRole = ({ role }) => {
|
||||||
if (role === 'user') return <RoleUser />
|
if (role === 'user') return <RoleUser />
|
||||||
if (role === 'admin') return <RoleAdmin />
|
if (role === 'admin') return <RoleAdmin />
|
||||||
|
|
|
@ -66,11 +66,11 @@ const t = (input) => {
|
||||||
/*
|
/*
|
||||||
* Component to show an individual measurements set
|
* Component to show an individual measurements set
|
||||||
*
|
*
|
||||||
* @param {object} props - All React props
|
* @param {object} props - All Component props
|
||||||
* @param {number} id - The ID of the measurements set to load
|
* @param {number} props.id - The ID of the measurements set to load
|
||||||
* @param {bool} publicOnly - If the set should be used with the backend.getPublicSet method
|
* @param {bool} [props.publicOnly = false] - If the set should be used with the backend.getPublicSet method
|
||||||
* @param {function} Link - An optional framework-specific Link component to use for client-side routing
|
* @param {function} [props.Link = false] - An optional framework-specific Link component to use for client-side routing
|
||||||
* @param {object} measurementHelpProvider - A function that returns a url or action to show help for a specific measurement
|
* @param {function} [measurementHelpProvider = false] - A function that returns a url or action to show help for a specific measurement
|
||||||
*/
|
*/
|
||||||
export const Set = ({ id, publicOnly = false, Link = false, measurementHelpProvider = false }) => {
|
export const Set = ({ id, publicOnly = false, Link = false, measurementHelpProvider = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
@ -867,6 +867,12 @@ export const RenderedCSet = ({ mset, imperial }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component to create a new measurements set.
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const NewSet = () => {
|
export const NewSet = () => {
|
||||||
// Hooks
|
// Hooks
|
||||||
const backend = useBackend()
|
const backend = useBackend()
|
||||||
|
|
|
@ -16,11 +16,13 @@ import { NoIcon, OkIcon, PlusIcon, TrashIcon, UploadIcon } from '@freesewing/rea
|
||||||
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
import { ModalWrapper } from '@freesewing/react/components/Modal'
|
||||||
import { NewSet } from './Set.mjs'
|
import { NewSet } from './Set.mjs'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* The component for the an account/sets page
|
* The component for the measurements sets in the user's account.
|
||||||
*
|
*
|
||||||
* @param {object} props - All React props
|
* @component
|
||||||
* @param {function} Link - An optional framework-specific Link component
|
* @param {object} props - All component props
|
||||||
|
* @param {React.Component} props.Link - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Sets = ({ Link = false }) => {
|
export const Sets = ({ Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
@ -160,16 +162,20 @@ export const Sets = ({ Link = false }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* React component to display a (card of a) single measurements set
|
* A component to render a card of a single measurements set.
|
||||||
*
|
*
|
||||||
* @param {object} props - All React props
|
* This is a pure render component, you need to pass in the data.
|
||||||
* @param {function} Link - An optional framework-specific Link component
|
*
|
||||||
* @param {string} design - The designs for which to check required measurements
|
* @component
|
||||||
* @param {test} href - Where the set should link to
|
* @param {object} props - All component props
|
||||||
* @param {function} onClick - What to do when clicking on a set
|
* @param {React.Component} [props.Link = false] - An optional framework-specific Link component
|
||||||
* @param {object} set - The (data of the) measurements set
|
* @param {string} [props.design = false] - An optional design name to check for required measurements in this set
|
||||||
* @param {string} size - Size of the card
|
* @param {string} [props.href = false] - On optional href for the card to link to
|
||||||
* @param {bool} useA - Whether to use an A tag or not
|
* @param {function} [props.onClick = false] - On optional onClick handler method
|
||||||
|
* @param {object} props.set - The data of the measurements set
|
||||||
|
* @param {string} [props.size = 'lg'] - Size of the card, one of lg, md, or sm
|
||||||
|
* @param {bool} [props.useA = false] - Whether to use an A tag or a Link component for href
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const MsetCard = ({
|
export const MsetCard = ({
|
||||||
Link = false,
|
Link = false,
|
||||||
|
@ -183,7 +189,7 @@ export const MsetCard = ({
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
const sizes = {
|
const sizes = {
|
||||||
lg: 96,
|
lg: 96,
|
||||||
md: 52,
|
md: 48,
|
||||||
sm: 36,
|
sm: 36,
|
||||||
}
|
}
|
||||||
const s = sizes[size]
|
const s = sizes[size]
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a badge for the account status you pass it
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {number} props.status - The account status. One of -2, -1, 0, or 1
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
export const AccountStatus = ({ status }) => {
|
export const AccountStatus = ({ status }) => {
|
||||||
if (status === 0) return <AccountInactive />
|
if (status === 0) return <AccountInactive />
|
||||||
if (status === 1) return <AccountActive />
|
if (status === 1) return <AccountActive />
|
||||||
|
|
|
@ -17,11 +17,12 @@ import { NumberCircle } from '@freesewing/react/components/Number'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { WelcomeIcons } from './shared.mjs'
|
import { WelcomeIcons } from './shared.mjs'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/preferences/units page
|
* A component to manage the user's units
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Units = ({ welcome = false }) => {
|
export const Units = ({ welcome = false }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
|
@ -16,12 +16,14 @@ import { StringInput } from '@freesewing/react/components/Input'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { WelcomeIcons } from './shared.mjs'
|
import { WelcomeIcons } from './shared.mjs'
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Component for the account/username page
|
* A component to manage the user's username
|
||||||
*
|
*
|
||||||
* @params {object} props - All React props
|
* @component
|
||||||
* @params {bool} props.welcome - Set to true to use this component on the welcome page
|
* @param {object} props - All component props
|
||||||
* @params {function} props.Link - A framework specific Link component for client-side routing
|
* @param {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view
|
||||||
|
* @param {React.Component} [props.Link = false] - A framework specific Link component for client-side routing
|
||||||
|
* @returns {JSX.Element}
|
||||||
*/
|
*/
|
||||||
export const Username = ({ welcome = false, Link = false }) => {
|
export const Username = ({ welcome = false, Link = false }) => {
|
||||||
if (!Link) Link = WebLink
|
if (!Link) Link = WebLink
|
||||||
|
|
|
@ -1,71 +1,71 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import { AccountStatus } from './Status.mjs'
|
import { AccountStatus } from './Status.mjs'
|
||||||
import { Bookmarks, BookmarkButton } from './Bookmarks.mjs'
|
|
||||||
import { Links } from './Links.mjs'
|
|
||||||
import { Set, NewSet } from './Set.mjs'
|
|
||||||
import { Sets, MsetCard } from './Sets.mjs'
|
|
||||||
import { Patterns } from './Patterns.mjs'
|
|
||||||
import { Pattern, PatternCard } from './Pattern.mjs'
|
|
||||||
import { Apikeys } from './Apikeys.mjs'
|
import { Apikeys } from './Apikeys.mjs'
|
||||||
import { Username } from './Username.mjs'
|
|
||||||
import { Bio } from './Bio.mjs'
|
|
||||||
import { Avatar } from './Avatar.mjs'
|
import { Avatar } from './Avatar.mjs'
|
||||||
import { Email, EmailChangeConfirmation } from './Email.mjs'
|
import { Bio } from './Bio.mjs'
|
||||||
import { Github } from './Github.mjs'
|
import { BookmarkButton, Bookmarks } from './Bookmarks.mjs'
|
||||||
import { Instagram, Mastodon, Reddit, Twitch, Tiktok, Website } from './Platform.mjs'
|
|
||||||
import { Compare } from './Compare.mjs'
|
import { Compare } from './Compare.mjs'
|
||||||
import { Control } from './Control.mjs'
|
|
||||||
import { Units } from './Units.mjs'
|
|
||||||
import { Newsletter } from './Newsletter.mjs'
|
|
||||||
import { Consent } from './Consent.mjs'
|
import { Consent } from './Consent.mjs'
|
||||||
import { Password } from './Password.mjs'
|
import { Control } from './Control.mjs'
|
||||||
import { Mfa } from './Mfa.mjs'
|
import { Email, EmailChangeConfirmation } from './Email.mjs'
|
||||||
import { ImportSet } from './Import.mjs'
|
|
||||||
import { Export } from './Export.mjs'
|
import { Export } from './Export.mjs'
|
||||||
|
import { Github } from './Github.mjs'
|
||||||
|
import { ImportSet } from './Import.mjs'
|
||||||
|
import { Instagram, Mastodon, Reddit, Twitch, Tiktok, Website } from './Platform.mjs'
|
||||||
|
import { Links } from './Links.mjs'
|
||||||
|
import { Mfa } from './Mfa.mjs'
|
||||||
|
import { MsetCard, Sets } from './Sets.mjs'
|
||||||
|
import { Newsletter } from './Newsletter.mjs'
|
||||||
|
import { Password } from './Password.mjs'
|
||||||
|
import { Pattern, PatternCard } from './Pattern.mjs'
|
||||||
|
import { Patterns } from './Patterns.mjs'
|
||||||
import { Reload } from './Reload.mjs'
|
import { Reload } from './Reload.mjs'
|
||||||
import { Remove } from './Remove.mjs'
|
import { Remove } from './Remove.mjs'
|
||||||
import { Restrict } from './Restrict.mjs'
|
import { Restrict } from './Restrict.mjs'
|
||||||
|
import { Set, NewSet } from './Set.mjs'
|
||||||
|
import { Units } from './Units.mjs'
|
||||||
import { UserId } from './Id.mjs'
|
import { UserId } from './Id.mjs'
|
||||||
|
import { Username } from './Username.mjs'
|
||||||
import { UserRole } from './Role.mjs'
|
import { UserRole } from './Role.mjs'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AccountStatus,
|
AccountStatus,
|
||||||
Bookmarks,
|
|
||||||
BookmarkButton,
|
|
||||||
Links,
|
|
||||||
Set,
|
|
||||||
NewSet,
|
|
||||||
Sets,
|
|
||||||
MsetCard,
|
|
||||||
Patterns,
|
|
||||||
Pattern,
|
|
||||||
PatternCard,
|
|
||||||
Apikeys,
|
Apikeys,
|
||||||
Username,
|
|
||||||
Bio,
|
|
||||||
Avatar,
|
Avatar,
|
||||||
|
Bio,
|
||||||
|
BookmarkButton,
|
||||||
|
Bookmarks,
|
||||||
|
Compare,
|
||||||
|
Consent,
|
||||||
|
Control,
|
||||||
Email,
|
Email,
|
||||||
EmailChangeConfirmation,
|
EmailChangeConfirmation,
|
||||||
Github,
|
|
||||||
Instagram,
|
|
||||||
Mastodon,
|
|
||||||
Reddit,
|
|
||||||
Twitch,
|
|
||||||
Tiktok,
|
|
||||||
Website,
|
|
||||||
Compare,
|
|
||||||
Control,
|
|
||||||
Units,
|
|
||||||
Newsletter,
|
|
||||||
Consent,
|
|
||||||
Password,
|
|
||||||
Mfa,
|
|
||||||
ImportSet,
|
|
||||||
Export,
|
Export,
|
||||||
|
Github,
|
||||||
|
ImportSet,
|
||||||
|
Instagram,
|
||||||
|
Links,
|
||||||
|
Mastodon,
|
||||||
|
Mfa,
|
||||||
|
MsetCard,
|
||||||
|
NewSet,
|
||||||
|
Newsletter,
|
||||||
|
Password,
|
||||||
|
Pattern,
|
||||||
|
PatternCard,
|
||||||
|
Patterns,
|
||||||
|
Reddit,
|
||||||
Reload,
|
Reload,
|
||||||
Remove,
|
Remove,
|
||||||
Restrict,
|
Restrict,
|
||||||
|
Set,
|
||||||
|
Sets,
|
||||||
|
Tiktok,
|
||||||
|
Twitch,
|
||||||
|
Units,
|
||||||
UserId,
|
UserId,
|
||||||
|
Username,
|
||||||
UserRole,
|
UserRole,
|
||||||
|
Website,
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const Uuid = ({ uuid, href = false, label = false }) => {
|
||||||
return (
|
return (
|
||||||
<span className="flex flex-row items-center">
|
<span className="flex flex-row items-center">
|
||||||
<span className="daisy-badge daisy-badge-secondary font-mono">{shortUuid(uuid)}</span>
|
<span className="daisy-badge daisy-badge-secondary font-mono">{shortUuid(uuid)}</span>
|
||||||
<CopyToClipboard content={uuid} label="UUID" sup />
|
<CopyToClipboardButton content={uuid} label="UUID" sup />
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export const Uuid = ({ uuid, href = false, label = false }) => {
|
||||||
<Link href={href} title={uuid}>
|
<Link href={href} title={uuid}>
|
||||||
<span className="daisy-badge daisy-badge-secondary font-mono">{shortUuid(uuid)}</span>
|
<span className="daisy-badge daisy-badge-secondary font-mono">{shortUuid(uuid)}</span>
|
||||||
</Link>
|
</Link>
|
||||||
<CopyToClipboard content={uuid} label="UUID" sup label />
|
<CopyToClipboardButton content={uuid} label="UUID" sup label />
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
mkdir -p ./docs/components
|
mkdir -p ./docs/components
|
||||||
|
|
||||||
jsdoc -c jsdoc.json components/Account/ > ../../sites/dev/prebuild/jsdoc/react/components/account.json
|
jsdoc -c jsdoc.json components/Account/* > ../../sites/dev/prebuild/jsdoc/react/components/account.json
|
||||||
jsdoc -c jsdoc.json components/Button/ > ../../sites/dev/prebuild/jsdoc/react/components/button.json
|
jsdoc -c jsdoc.json components/Button/* > ../../sites/dev/prebuild/jsdoc/react/components/button.json
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
AccountStatus,
|
||||||
|
Apikeys as ApikeysExample,
|
||||||
|
Avatar as AvatarExample,
|
||||||
|
Bio as BioExample,
|
||||||
|
BookmarkButton,
|
||||||
|
Bookmarks as BookmarksExample,
|
||||||
|
Compare as CompareExample,
|
||||||
|
Consent as ConsentExample,
|
||||||
|
Control as ControlExample,
|
||||||
|
Email as EmailExample,
|
||||||
|
EmailChangeConfirmation as EmailChangeConfirmationExample,
|
||||||
|
Export as ExportExample,
|
||||||
|
Github as GithubExample,
|
||||||
|
ImportSet as ImportSetExample,
|
||||||
|
Instagram as InstagramExample,
|
||||||
|
Links as LinksExample,
|
||||||
|
Mastodon as MastodonExample,
|
||||||
|
Mfa as MfaExample,
|
||||||
|
MsetCard,
|
||||||
|
NewSet as NewSetExample,
|
||||||
|
Newsletter as NewsletterExample,
|
||||||
|
} from '@freesewing/react/components/Account'
|
||||||
|
|
||||||
|
const AccountStatusExample = () => (
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Preview</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>-2</td><td><AccountStatus status={-2} /></td></tr>
|
||||||
|
<tr><td>-1</td><td><AccountStatus status={-1} /></td></tr>
|
||||||
|
<tr><td>0</td><td><AccountStatus status={0} /></td></tr>
|
||||||
|
<tr><td>1</td><td><AccountStatus status={1} /></td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)
|
||||||
|
|
||||||
|
const BookmarkButtonExample = () => (
|
||||||
|
<BookmarkButton
|
||||||
|
slug="https://freesewing.dev/reference/packages/react/components/account/#bookmarkbutton"
|
||||||
|
title="BookmarkButton Example"
|
||||||
|
type="custom"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
const MsetCardExample = () => (
|
||||||
|
<MsetCard set={{ name: 'Example Set'}} />
|
||||||
|
)
|
||||||
|
|
||||||
|
export {
|
||||||
|
AccountStatusExample,
|
||||||
|
ApikeysExample,
|
||||||
|
AvatarExample,
|
||||||
|
BioExample,
|
||||||
|
BookmarkButtonExample,
|
||||||
|
BookmarksExample,
|
||||||
|
CompareExample,
|
||||||
|
ConsentExample,
|
||||||
|
ControlExample,
|
||||||
|
EmailExample,
|
||||||
|
EmailChangeConfirmationExample,
|
||||||
|
ExportExample,
|
||||||
|
GithubExample,
|
||||||
|
ImportSetExample,
|
||||||
|
InstagramExample,
|
||||||
|
LinksExample,
|
||||||
|
MastodonExample,
|
||||||
|
MfaExample,
|
||||||
|
MsetCardExample,
|
||||||
|
NewSetExample,
|
||||||
|
NewsletterExample,
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,203 @@
|
||||||
title: Account
|
title: Account
|
||||||
---
|
---
|
||||||
|
|
||||||
:::note
|
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
||||||
This page is yet to be created
|
import { ComponentDocs } from '@site/src/components/component-docs.js'
|
||||||
:::
|
import { MiniNote} from '@freesewing/react/components/Mini'
|
||||||
|
import {
|
||||||
|
jsdocAccountStatus as jsdocAccount,
|
||||||
|
jsdocAccountStatus,
|
||||||
|
jsdocApikeys,
|
||||||
|
jsdocAvatar,
|
||||||
|
jsdocBio,
|
||||||
|
jsdocBookmarkButton,
|
||||||
|
jsdocBookmarks,
|
||||||
|
jsdocCompare,
|
||||||
|
jsdocConsent,
|
||||||
|
jsdocControl,
|
||||||
|
jsdocEmail,
|
||||||
|
jsdocEmailChangeConfirmation,
|
||||||
|
jsdocExport,
|
||||||
|
jsdocGithub,
|
||||||
|
jsdocImportSet,
|
||||||
|
jsdocInstagram,
|
||||||
|
jsdocLinks,
|
||||||
|
jsdocMastodon,
|
||||||
|
jsdocMfa,
|
||||||
|
jsdocMsetCard,
|
||||||
|
jsdocNewSet,
|
||||||
|
jsdocNewsletter,
|
||||||
|
} from '@site/prebuild/jsdoc/components.account.mjs'
|
||||||
|
import {
|
||||||
|
AccountStatusExample,
|
||||||
|
ApikeysExample,
|
||||||
|
AvatarExample,
|
||||||
|
BioExample,
|
||||||
|
BookmarkButtonExample,
|
||||||
|
BookmarksExample,
|
||||||
|
CompareExample,
|
||||||
|
ConsentExample,
|
||||||
|
ControlExample,
|
||||||
|
EmailExample,
|
||||||
|
EmailChangeConfirmationExample,
|
||||||
|
ExportExample,
|
||||||
|
GithubExample,
|
||||||
|
ImportSetExample,
|
||||||
|
InstagramExample,
|
||||||
|
LinksExample,
|
||||||
|
MastodonExample,
|
||||||
|
MfaExample,
|
||||||
|
MsetCardExample,
|
||||||
|
NewSetExample,
|
||||||
|
NewsletterExample,
|
||||||
|
} from './_examples.js'
|
||||||
|
|
||||||
|
<DocusaurusDoc>
|
||||||
|
|
||||||
|
The **Account** component family provides the following components:
|
||||||
|
|
||||||
|
- [AccountStatus ](#accountstatus)
|
||||||
|
- [Apikeys ](#apikeys)
|
||||||
|
- [Avatar ](#avatar)
|
||||||
|
- [Bio ](#bio)
|
||||||
|
- [BookmarkButton ](#bookmarkbutton)
|
||||||
|
- [Bookmarks ](#bookmarks)
|
||||||
|
- [Compare ](#compare)
|
||||||
|
- [Consent ](#consent)
|
||||||
|
- [Control ](#control)
|
||||||
|
- [Email ](#email)
|
||||||
|
- [EmailChangeConfirmation](#emailchanfirmation)
|
||||||
|
- [Export ](#export)
|
||||||
|
- [Github ](#github)
|
||||||
|
- [ImportSet ](#importset)
|
||||||
|
- [Instagram ](#instagram)
|
||||||
|
- [Links ](#links)
|
||||||
|
- [Mastodon ](#mastodon)
|
||||||
|
- [Mfa ](#mfa)
|
||||||
|
- [MsetCard ](#msetcard)
|
||||||
|
- [NewSet ](#newset)
|
||||||
|
- [Newsletter ](#newslett)
|
||||||
|
- [Password ](#password)
|
||||||
|
- [Pattern ](#pattern)
|
||||||
|
- [PatternCard ](#patterncard)
|
||||||
|
- [Patterns ](#patterns)
|
||||||
|
- [Reddit ](#reddit)
|
||||||
|
- [Reload ](#reload)
|
||||||
|
- [Remove ](#remove)
|
||||||
|
- [Restrict ](#restrict)
|
||||||
|
- [Set ](#set)
|
||||||
|
- [Sets ](#sets)
|
||||||
|
- [Tiktok ](#tiktok)
|
||||||
|
- [Twitch ](#twitch)
|
||||||
|
- [Units ](#units)
|
||||||
|
- [UserId ](#userid)
|
||||||
|
- [Username ](#username)
|
||||||
|
- [UserRole ](#userrole)
|
||||||
|
- [Website ](#website)
|
||||||
|
|
||||||
|
|
||||||
|
## AccountStatus
|
||||||
|
<ComponentDocs docs={jsdocAccountStatus} example={AccountStatusExample} />
|
||||||
|
|
||||||
|
## Apikeys
|
||||||
|
<ComponentDocs docs={jsdocApikeys} example={ApikeysExample} />
|
||||||
|
|
||||||
|
## Avatar
|
||||||
|
<ComponentDocs docs={jsdocAvatar} example={AvatarExample} />
|
||||||
|
|
||||||
|
## Bio
|
||||||
|
<ComponentDocs docs={jsdocBio} example={BioExample} />
|
||||||
|
|
||||||
|
## BookmarkButton
|
||||||
|
<ComponentDocs docs={jsdocBookmarkButton} example={BookmarkButtonExample} />
|
||||||
|
|
||||||
|
## Bookmarks
|
||||||
|
<ComponentDocs docs={jsdocBookmarks} example={BookmarksExample} />
|
||||||
|
|
||||||
|
## Compare
|
||||||
|
<ComponentDocs docs={jsdocCompare} example={CompareExample} />
|
||||||
|
|
||||||
|
## Consent
|
||||||
|
<ComponentDocs docs={jsdocConsent} example={ConsentExample} />
|
||||||
|
|
||||||
|
## Control
|
||||||
|
<ComponentDocs docs={jsdocControl} example={ControlExample} />
|
||||||
|
|
||||||
|
## Email
|
||||||
|
<ComponentDocs docs={jsdocEmail} example={EmailExample} />
|
||||||
|
|
||||||
|
## EmailChangeConfirmation
|
||||||
|
<MiniNote>
|
||||||
|
#### Requires a valid callback URL
|
||||||
|
This component will not work without the proper <code>id</code> and <code>check</code> URL paramters
|
||||||
|
that come from a email confirmation link sent out from the FreeSewing backend.
|
||||||
|
</MiniNote>
|
||||||
|
|
||||||
|
<ComponentDocs docs={jsdocEmailChangeConfirmation} example={EmailChangeConfirmationExample} />
|
||||||
|
|
||||||
|
## Export
|
||||||
|
<ComponentDocs docs={jsdocExport} example={ExportExample} />
|
||||||
|
|
||||||
|
## Github
|
||||||
|
<ComponentDocs docs={jsdocGithub} example={GithubExample} />
|
||||||
|
|
||||||
|
## ImportSet
|
||||||
|
<ComponentDocs docs={jsdocImportSet} example={ImportSetExample} />
|
||||||
|
|
||||||
|
## Instagram
|
||||||
|
<ComponentDocs docs={jsdocInstagram} example={InstagramExample} />
|
||||||
|
|
||||||
|
## Links
|
||||||
|
<ComponentDocs docs={jsdocLinks} example={LinksExample} />
|
||||||
|
|
||||||
|
## Mastodon
|
||||||
|
<ComponentDocs docs={jsdocMastodon} example={MastodonExample} />
|
||||||
|
|
||||||
|
## Mfa
|
||||||
|
<ComponentDocs docs={jsdocMfa} example={MfaExample} />
|
||||||
|
|
||||||
|
## MsetCard
|
||||||
|
<ComponentDocs docs={jsdocMsetCard} example={MsetCardExample} />
|
||||||
|
|
||||||
|
## NewSet
|
||||||
|
<ComponentDocs docs={jsdocNewSet} example={NewSetExample} />
|
||||||
|
|
||||||
|
## Newsletter
|
||||||
|
<ComponentDocs docs={jsdocNewsletter} example={NewsletterExample} />
|
||||||
|
|
||||||
|
## Password
|
||||||
|
|
||||||
|
## Pattern
|
||||||
|
|
||||||
|
## PatternCard
|
||||||
|
|
||||||
|
## Patterns
|
||||||
|
|
||||||
|
## Reddit
|
||||||
|
|
||||||
|
## Reload
|
||||||
|
|
||||||
|
## Remove
|
||||||
|
|
||||||
|
## Restrict
|
||||||
|
|
||||||
|
## Set
|
||||||
|
|
||||||
|
## Sets
|
||||||
|
|
||||||
|
## Tiktok
|
||||||
|
|
||||||
|
## Twitch
|
||||||
|
|
||||||
|
## Units
|
||||||
|
|
||||||
|
## UserId
|
||||||
|
|
||||||
|
## Username
|
||||||
|
|
||||||
|
## UserRole
|
||||||
|
|
||||||
|
## Website
|
||||||
|
|
||||||
|
</DocusaurusDoc>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { Highlight } from '@freesewing/react/components/Highlight'
|
||||||
|
import { FingerprintIcon, WarningIcon } from '@freesewing/react/components/Icon'
|
||||||
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
|
import { MiniNote } from '@freesewing/react/components/Mini'
|
||||||
|
|
||||||
|
export const IconButtonExample = () => (
|
||||||
|
<>
|
||||||
|
<MiniNote>
|
||||||
|
Note that this component will take up the full width made available to it.
|
||||||
|
</MiniNote>
|
||||||
|
<Highlight language="js">
|
||||||
|
{[
|
||||||
|
`import { FingerprintIcon, WarningIcon } from '@freesewing/react/components/Icon'`,
|
||||||
|
`import { IconButton } from '@freesewing/react/components/Button'`,
|
||||||
|
``,
|
||||||
|
`<IconButton>`,
|
||||||
|
` <FingerprintIcon />`,
|
||||||
|
` Primary (default)`,
|
||||||
|
`</IconButton>`,
|
||||||
|
`<br />`,
|
||||||
|
`<IconButton color="warning">`,
|
||||||
|
` <WarningIcon />`,
|
||||||
|
` Warning`,
|
||||||
|
`</IconButton>`,
|
||||||
|
].join('\n')}
|
||||||
|
</Highlight>
|
||||||
|
<IconButton>
|
||||||
|
<FingerprintIcon />
|
||||||
|
Primary (default)
|
||||||
|
</IconButton>
|
||||||
|
<br />
|
||||||
|
<IconButton color="warning">
|
||||||
|
<WarningIcon />
|
||||||
|
Warning
|
||||||
|
</IconButton>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
|
@ -3,8 +3,9 @@ title: Button
|
||||||
---
|
---
|
||||||
|
|
||||||
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
||||||
import { jsdocIconButton } from '@site/prebuild/jsdoc/components.button.mjs'
|
|
||||||
import { ComponentDocs } from '@site/src/components/component-docs.js'
|
import { ComponentDocs } from '@site/src/components/component-docs.js'
|
||||||
|
import { jsdocIconButton } from '@site/prebuild/jsdoc/components.button.mjs'
|
||||||
|
import { IconButtonExample } from './_examples.js'
|
||||||
|
|
||||||
<DocusaurusDoc>
|
<DocusaurusDoc>
|
||||||
|
|
||||||
|
@ -14,6 +15,6 @@ The **Button** component family provides the following components:
|
||||||
|
|
||||||
## IconButton
|
## IconButton
|
||||||
|
|
||||||
<ComponentDocs docs={jsdocIconButton} />
|
<ComponentDocs docs={jsdocIconButton} example={IconButtonExample} />
|
||||||
|
|
||||||
</DocusaurusDoc>
|
</DocusaurusDoc>
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { FingerprintIcon, WarningIcon } from '@freesewing/react/components/Icon'
|
||||||
import { IconButton } from '@freesewing/react/components/Button'
|
import { IconButton } from '@freesewing/react/components/Button'
|
||||||
import { MiniNote } from '@freesewing/react/components/Mini'
|
import { MiniNote } from '@freesewing/react/components/Mini'
|
||||||
|
|
||||||
export const ComponentDocs = ({ docs }) => {
|
export const ComponentDocs = ({ docs, example }) => {
|
||||||
|
const Example = example || null
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>{docs.desc}</p>
|
<p>{docs.desc}</p>
|
||||||
|
@ -18,40 +19,14 @@ export const ComponentDocs = ({ docs }) => {
|
||||||
<Highlight language="js">{docs.importAs}</Highlight>
|
<Highlight language="js">{docs.importAs}</Highlight>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab>
|
<Tab>
|
||||||
<p>
|
{docs.params
|
||||||
The <code>{docs.name}</code> component takes the following props:
|
? <p> The <code>{docs.name}</code> component takes the following props:</p>
|
||||||
</p>
|
: <MiniNote>This component does not take any props</MiniNote>
|
||||||
<PropsTable docs={docs} />
|
}
|
||||||
|
{docs.params ? <PropsTable docs={docs} /> : null}
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab>
|
<Tab>
|
||||||
<MiniNote>
|
<Example />
|
||||||
Note that this component will take up the full width made available to it.
|
|
||||||
</MiniNote>
|
|
||||||
<Highlight language="js">
|
|
||||||
{[
|
|
||||||
`import { FingerprintIcon, WarningIcon } from '@freesewing/react/components/Icon'`,
|
|
||||||
`import { IconButton } from '@freesewing/react/components/Button'`,
|
|
||||||
``,
|
|
||||||
`<IconButton>`,
|
|
||||||
` <FingerprintIcon />`,
|
|
||||||
` Primary (default)`,
|
|
||||||
`</IconButton>`,
|
|
||||||
`<br />`,
|
|
||||||
`<IconButton color="warning">`,
|
|
||||||
` <WarningIcon />`,
|
|
||||||
` Warning`,
|
|
||||||
`</IconButton>`,
|
|
||||||
].join('\n')}
|
|
||||||
</Highlight>
|
|
||||||
<IconButton>
|
|
||||||
<FingerprintIcon />
|
|
||||||
Primary (default)
|
|
||||||
</IconButton>
|
|
||||||
<br />
|
|
||||||
<IconButton color="warning">
|
|
||||||
<WarningIcon />
|
|
||||||
Warning
|
|
||||||
</IconButton>
|
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab>
|
<Tab>
|
||||||
<p>
|
<p>
|
||||||
|
@ -86,17 +61,26 @@ const PropsTable = ({ docs }) => (
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{docs.params.map((prop, i) => (
|
{(docs.params || []).map((prop, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>{prop.name}</td>
|
<td>{prop.name}</td>
|
||||||
<td>{prop.type.names}</td>
|
<td>{prop.type.names}</td>
|
||||||
<td>{prop.description}</td>
|
<td>{prop.description}</td>
|
||||||
<td>{prop.optional ? 'yes' : 'no'}</td>
|
<td>{prop.optional ? 'yes' : 'no'}</td>
|
||||||
<td>
|
<td>
|
||||||
<code>{prop.defaultvalue}</code>
|
<code><DefaultPropValue value={prop.defaultvalue} /></code>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DefaultPropValue = ({ value }) => {
|
||||||
|
if (value === true) return 'true'
|
||||||
|
if (value === false) return 'false'
|
||||||
|
if (value === null) return 'null'
|
||||||
|
if (typeof value === 'undefined') return 'undefined'
|
||||||
|
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue