This repository has been archived on 2025-05-09. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Astral-nook/resources/scripts/components/elements/Code.tsx
2022-06-20 15:28:27 -04:00

19 lines
527 B
TypeScript

import React from 'react';
import classNames from 'classnames';
interface CodeProps {
dark?: boolean | undefined;
className?: string;
children: React.ReactChild | React.ReactFragment | React.ReactPortal;
}
export default ({ dark, className, children }: CodeProps) => (
<code
className={classNames('font-mono text-sm px-2 py-1 inline-block rounded', className, {
'bg-neutral-700': !dark,
'bg-neutral-900 text-gray-100': dark,
})}
>
{children}
</code>
);