Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Opinionated Button #979

Open
4 tasks
ErikSin opened this issue Feb 17, 2025 · 0 comments
Open
4 tasks

Create Opinionated Button #979

ErikSin opened this issue Feb 17, 2025 · 0 comments

Comments

@ErikSin
Copy link
Contributor

ErikSin commented Feb 17, 2025

Create new Button components with the design system opinionated styles.

To To

  • add jsdoc deprecated tag to the original button component
  • Create Primary button according to design system
  • Create Secondary button according to design system
  • Create Destructive button according to design system

Example of component

import type {IconProps} from 'react-native-vector-icons/Icon';

type RestrictedIconProps = Omit<IconProps, 'size' | 'color' | 'style'>;

type IconButtonProps = {
  label: string;
  onPress: () => void;
  fullWidth?:boolean
  icon?: React.ReactElement<RestrictedIconProps>; //This enforces a react-native-vector-icon, but the size, color, and style cannot be set
};

export const PrimaryButton = ({
  label,
  onPress,
  icon,
}) => {
  return (
    <TouchableOpacity style={...opinionated style} onPress={onPress}>
      {icon && <Text style={...opinionated color and size}>{icon}</Text>} //vector icons are built off text, so you can pass the size and color to the parent text icon, and the icon will inherit it.
      <HeaderText style={...opinionated color} variant="header5">
        {label}
      </HeaderText>
    </TouchableOpacity>
  );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant