import { css } from '@emotion/react'; import { spacing, theme } from '@expo/styleguide'; import { EnumDefinitionData, EnumValueData } from '~/components/plugins/api/APIDataTypes'; import { APISectionDeprecationNote } from '~/components/plugins/api/APISectionDeprecationNote'; import { APISectionPlatformTags } from '~/components/plugins/api/APISectionPlatformTags'; import { CommentTextBlock, getTagNamesList, STYLES_APIBOX, STYLES_APIBOX_NESTED, H3Code, } from '~/components/plugins/api/APISectionUtils'; import { H2, H4, CODE } from '~/ui/components/Text'; export type APISectionEnumsProps = { data: EnumDefinitionData[]; }; const sortByValue = (a: EnumValueData, b: EnumValueData) => { if (a.defaultValue && b.defaultValue) { if (a.defaultValue.includes(`'`) && b.defaultValue.includes(`'`)) { return a.defaultValue.localeCompare(b.defaultValue); } else { return parseInt(a.defaultValue, 10) - parseInt(b.defaultValue, 10); } } return 0; }; const renderEnum = ({ name, children, comment }: EnumDefinitionData): JSX.Element => (
{name}
{enumValue.name}
{name}.{enumValue.name}
{enumValue?.defaultValue ? ` = ${enumValue?.defaultValue}` : ''}