xref: /expo/docs/components/plugins/APIBox.tsx (revision fc13df4e)
1import React from 'react';
2
3import { H3 } from '~/components/plugins/Headings';
4import { STYLES_APIBOX } from '~/components/plugins/api/APISectionUtils';
5import { PlatformName } from '~/types/common';
6import { PlatformTags } from '~/ui/components/Tag';
7
8type APIBoxProps = React.PropsWithChildren<{
9  header?: string;
10  platforms?: PlatformName[];
11}>;
12
13export const APIBox = ({ header, platforms, children }: APIBoxProps) => {
14  return (
15    <div css={STYLES_APIBOX}>
16      {platforms && <PlatformTags prefix="Only for:" platforms={platforms} />}
17      {header && <H3 tags={platforms}>{header}</H3>}
18      {children}
19    </div>
20  );
21};
22