/**
 * 站点标签组件
 * @邠心vbe on 2023/11/30
 */
import React from 'react';
import { StyleSheet } from 'react-native';
import TextView from './TextView';

const SiteLabelView = ({
  label,
  color = textLight,
  version=1,
  background = colorPrimary
}) => {
  if (label) {
    return (
      <TextView
        style={[
          version == 2
          ? style.textV2
          : style.textV1,
          {
            color: color || textLight,
            backgroundColor: background || colorPrimary
          }
        ]}>
        {label}
      </TextView>
    )
  } else {
    return <></>
  }
};

export default SiteLabelView;

const style = StyleSheet.create({
  textV1: {
    height: 22,
    fontSize: 12,
    marginRight: 5,
    marginBottom: 5,
    borderRadius: 3,
    ...$padding(0, 6)
  },
  textV2: {
    height: 20,
    fontSize: 8,
    marginRight: 6,
    borderRadius: 30,
    ...$padding(0, 10)
  }
})