/**
 * Divider 分割线组件
 * 用于分隔内容
 */

import React from 'react';
import { View, StyleSheet, ViewStyle } from 'react-native';
import { spacing, useAppColors } from '../../theme';

interface DividerProps {
  margin?: number;
  color?: string;
  style?: ViewStyle;
}

const Divider: React.FC<DividerProps> = ({ margin = spacing.lg, color, style }) => {
  const colors = useAppColors();
  const lineColor = color ?? colors.divider;
  return (
    <View
      style={[
        styles.divider,
        { marginVertical: margin, backgroundColor: lineColor },
        style,
      ]}
    />
  );
};

const styles = StyleSheet.create({
  divider: {
    height: 1,
    width: '100%',
  },
});

export default Divider;
