import React, { ReactElement } from 'react'; import { StyleSheet, View } from 'react-native'; import { IconProps, SemanticColor } from '../../foundation'; import { isNotNil } from '../../internal/utils/functions'; type Props = { position?: 'relative' | 'absolute'; right?: number; left?: number; top?: number; bottom?: number; children?: ReactElement; }; /** * # NotificationDot 컴포넌트 * * - Icon 컴포넌트와 함께 사용할때 * - size가 24인 Icon 컴포넌트를 NotificationDot의 children으로 넣어주세요. * - `{ position: 'absolute', left: 19, bottom: 21 }` 이 기본값입니다. * - 필요에따라 스타일을 조정해주세요. * * - Text 컴포넌트와 함께 사용할때 * - 상황에 따라 View 컴포넌트로 감싸서 사용해주세요. * - 감싼 View 컴포넌트에 `flexDirection: 'row', gap: 2` 를 설정해주세요. * - 텍스트와의 간격은 2 입니다. * * * ## Props * * ### `position` optional * - `relative` | `absolute` (기본값 'relative') * * ### `right` optional * - number * * ### `left` optional * - number * * ### `top` optional * - number * * ### `bottom` optional * - number * * @example * ```tsx * // 단독 사용 * * * // Icon과 함께 사용 (icon은 24 size로 설정) * * * * * * // Text와 함께 사용 * * 사무실/상업공간 이사 * * * ``` * */ export function NotificationDot(props: Props): React.JSX.Element { if (isNotNil(props.children)) { return ( {props.children} ); } return ( ); } const styles = StyleSheet.create({ outerCircle: { width: 8, height: 8, backgroundColor: SemanticColor.border_white, borderRadius: 12, }, innerCircle: { width: 6, height: 6, backgroundColor: SemanticColor.bg_red_enabled, borderRadius: 12, }, alignCenter: { alignItems: 'center', justifyContent: 'center' }, });