[react] feat: Added docs for components/Profile
This commit is contained in:
parent
320bcf8534
commit
d6cbe79dd5
4 changed files with 59 additions and 17 deletions
|
@ -14,31 +14,36 @@ import { MiniWarning } from '@freesewing/react/components/Mini'
|
|||
import { KeyVal } from '@freesewing/react/components/KeyVal'
|
||||
import Markdown from 'react-markdown'
|
||||
|
||||
/*
|
||||
* Component for the currently authenticated user's profile
|
||||
/**
|
||||
* A component for to display the current user's profile.
|
||||
*
|
||||
* @params {object} props - All React props
|
||||
* @param {number} props.uid - The user ID for which to show the profile
|
||||
* @param {function} props.Link - An optional framework-specific Link component
|
||||
* @component
|
||||
* @param {object} props - All component props
|
||||
* @param {React.FC} [props.Link = false] - An optional framework-specific Link component
|
||||
* @param {function} [props.setTitle = false] - An optional method to set the page title
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export const OwnProfile = (props) => {
|
||||
const { account } = useAccount()
|
||||
|
||||
return <UserProfile uid={account.id} {...props} />
|
||||
return <UserProfile {...props} uid={account.id} />
|
||||
}
|
||||
|
||||
/*
|
||||
* Component for a user profile
|
||||
/**
|
||||
* A component for to display a user profile. Either props.uid or props.fromUrl should be set.
|
||||
*
|
||||
* @params {object} props - All React props
|
||||
* @param {number} props.uid - The user ID for which to show the profile
|
||||
* @param {function} props.Link - An optional framework-specific Link component
|
||||
* @component
|
||||
* @param {object} props - All component props
|
||||
* @param {boolean} [props.fromUrl = false] - Set this to the nbame of the search parameters in the URL to extract the UID from
|
||||
* @param {React.FC} [props.Link = false] - An optional framework-specific Link component
|
||||
* @param {function} [props.setTitle = false] - An optional method to set the page title
|
||||
* @param {number} [props.uid = false] - The user ID for which to show the profile
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export const UserProfile = ({
|
||||
Link = false,
|
||||
setTitle = false,
|
||||
uid = false,
|
||||
noBox = false,
|
||||
fromUrl = false,
|
||||
}) => {
|
||||
if (!uid && !fromUrl)
|
||||
|
@ -85,10 +90,12 @@ export const UserProfile = ({
|
|||
)
|
||||
}
|
||||
|
||||
/*
|
||||
* Shows an avatar image
|
||||
/**
|
||||
* A component to render an avatar image
|
||||
*
|
||||
* @component
|
||||
* @param {string} ihash - The ihash of the account
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export const Avatar = ({ ihash }) => {
|
||||
const { setModal } = useContext(ModalContext)
|
||||
|
|
|
@ -30,3 +30,4 @@ jsdoc -c jsdoc.json components/Number/* > ../../sites/dev/prebuild/jsdoc/react/c
|
|||
jsdoc -c jsdoc.json components/Patrons/* > ../../sites/dev/prebuild/jsdoc/react/components/patrons.json
|
||||
jsdoc -c jsdoc.json components/Pattern/* > ../../sites/dev/prebuild/jsdoc/react/components/pattern.json
|
||||
jsdoc -c jsdoc.json components/Popout/* > ../../sites/dev/prebuild/jsdoc/react/components/popout.json
|
||||
jsdoc -c jsdoc.json components/Profile/* > ../../sites/dev/prebuild/jsdoc/react/components/profile.json
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue