xref: /expo/docs/ui/components/Snippet/Snippet.tsx (revision dfd15ebd)
1import { css } from '@emotion/react';
2import { spacing } from '@expo/styleguide';
3import { PropsWithChildren } from 'react';
4
5type SnippetProps = {
6  includeMargin?: boolean;
7  className?: string;
8};
9
10export const Snippet = ({
11  children,
12  className,
13  includeMargin = true,
14}: PropsWithChildren<SnippetProps>) => (
15  <div css={[containerStyle, includeMargin && containerMarginStyle]} className={className}>
16    {children}
17  </div>
18);
19
20const containerStyle = css({
21  display: 'flex',
22  flexDirection: 'column',
23});
24
25const containerMarginStyle = css({ marginBottom: spacing[4] });
26