import React, { useState } from 'react' import { Heading } from '~components/Heading' import { InlineNotification } from '~components/Notification' import { CardContent } from './components/CardContent' import { CodeSnippet } from './components/CodeSnippet' type Props = { compiledCssPropertyName: string classKeyValues: { utilityClassName: string; cssProperty: string }[] renderExampleComponent: (utilityClass: string) => React.ReactElement isReversed?: boolean } export const TailwindStoryTemplate = ({ compiledCssPropertyName, classKeyValues, renderExampleComponent, }: Props): React.ReactElement => { const [copiedText, setCopiedText] = useState(null) return (
{classKeyValues.map((presetData, index) => { const { utilityClassName, cssProperty } = presetData return ( ) })}
Utility Class Compiled CSS Example
setCopiedText(text)} />

{compiledCssPropertyName}: {cssProperty}

{renderExampleComponent(utilityClassName)}
{copiedText && ( setCopiedText(null)} headingProps={{ children: 'Copied to clipboard: ', variant: 'heading-6', }} > {copiedText} )}
) } TailwindStoryTemplate.CardContent = CardContent TailwindStoryTemplate.displayName = 'TailwindStoryTemplate'