Convert this to tailwind const Callout = ({ emoji, children }) => ( <p> <span className="emoji">{emoji}</span> <span className="children">{children}</span> <style jsx>{` p { margin: 20px 0; line-height: 1.5; display: flex; background: #eee; padding: 15px 10px; font-size: 16px; align-items: center; } .children { display: block; } .emoji { font-size: 18px; display: block; width: 35px; text-align: center; } `}</style> </p> ); export default Callout;
Here's the Tailwind version of the code:
javascriptconst Callout = ({ emoji, children }) => (
<p className="bg-gray-200 flex items-center p-3 my-5 text-base">
<span className="block w-9 text-center text-xl mr-2">{emoji}</span>
<span className="block">{children}</span>
</p>
);
export default Callout;
Note that in the original code, there were CSS styles defined using style jsx
. In the Tailwind version, these styles are replaced with Tailwind classes, which are more concise and easier to use. The margin
property is replaced with my-5
for vertical margin, line-height
is not necessary because the text-base
class already sets a reasonable value, and align-items
is also unnecessary because items-center
class is used.