import React, { useState } from 'react' import { CloseIcon } from '@freesewing/react/components/Icon' const colors = { comment: 'secondary', error: 'error', fixme: 'warning', link: 'secondary', none: '', note: 'primary', related: 'info', tip: 'accent', tldr: 'info', warning: 'error', } /** * This popout component is a way to make some content stand out * * @param {object} props - All React props * @param {object} props.comment - Set this to make it a comment popout * @param {object} props.error - Set this to make it a error popout * @param {object} props.fixme - Set this to make it a fixme popout * @param {object} props.link - Set this to make it a link popout * @param {object} props.note - Set this to make it a note popout * @param {object} props.related - Set this to make it a related popout * @param {object} props.tip - Set this to make it a tip popout * @param {object} props.tldr - Set this to make it a tldr popout * @param {object} props.warning - Set this to make it a warning popout * @param {string} props.title - The popout title * @param {string} noP - Do not wrap the content in a p tag */ export const Popout = (props) => { // Make this hideable/dismissable const [hide, setHide] = useState(false) if (hide) return null let type = 'none' for (const c in colors) { if (props[c]) type = c } const color = colors[type] const { className = '' } = props return props.compact ? (
{props.children}
}