import { color } from '@preply/ds-core';
import { Feature } from '@preply/ds-core-types';
import { getTokenVar as t } from '@preply/ds-web-core';
import { Icon, LayoutFlex, Text } from '@preply/ds-web-lib';
import React, { FC } from 'react';
import { importSvgFileName } from '../functions/import-svg-file-name';
interface Props {
icon: Feature | null;
}
const CopyCodeBlock = ({ code }) => {
const positiveBg = t(color.background.positiveDark);
return (
{code}
);
};
const RNIconDetails: FC = ({ icon }) => {
if (!icon) return null;
if (!icon.name.startsWith('TokyoUI'))
return (
<>
React Native
Non-TokyoUI icons are not supported in React Native.
>
);
const rnIconName = icon.name.replace('TokyoUI', '');
const rnCodeSnippet = `
import { Icon } from '@preply/ds-rn-lib';
`;
return (
<>
React Native
>
);
};
export const IconDetails: FC = ({ icon }) => {
if (!icon) {
return (
);
}
const isDeprecated = typeof icon.name === 'string' && !icon.name.startsWith('TokyoUI');
const importStatement = `import ${icon.name} from '@preply/ds-media-icons/dist/24/${icon.name}.svg';`;
const iconUsage = ``;
return (
{isDeprecated && (
This icon is deprecated, use the "TokyoUI"-prefixed one
)}
{icon.name}
{icon.description}
Import the icon from:
Then render it using the Icon component:
Color customizations
The icon should allow changing its black fill color with everything else. Here the
icon should look red on a soft-red background.
);
};