import * as React from 'react' import classNames from 'classnames' import { Text, RichText, types, Link } from 'react-bricks/frontend' import { textColors } from '../colors' import blockNames from '../blockNames' interface FaqQuestionProps { id: string question?: types.TextValue answer?: types.TextValue } const FaqQuestion: types.Brick = ({ id, question, answer, }) => { const idAttribute = id ? { id } : {} return (
(

{id && ( )} {props.children}

)} placeholder="Answer..." /> (

{props.children}

)} placeholder="Answer..." allowedFeatures={[types.RichTextFeatures.Link]} renderLink={({ children, href, target, rel }) => ( {children} )} />
) } FaqQuestion.schema = { name: blockNames.Faq, label: 'Question', category: 'faq', hideFromAddMenu: true, playgroundLinkLabel: 'View source code on Github', playgroundLinkUrl: 'https://github.com/ReactBricks/reactbricks-starters/blob/main/packages/reactbricks-ui/nextjs-pages/src/Faq/FaqItem.tsx', getDefaultProps: () => ({ question: 'Is this the latest question?', answer: "This is either the first question or the one following the one before it. It is the last question if you did't add other questions after it.", }), sideEditProps: [ { name: 'id', label: 'Anchor ID', type: types.SideEditPropType.Text, }, ], } export default FaqQuestion