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

button component #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

button component #4

wants to merge 2 commits into from

Conversation

X905
Copy link

@X905 X905 commented Sep 22, 2020

  • Sabor primary del boton
  • Sabor secondary del boton

Comment on lines 1 to 19
export function Button(props){
const {className = '', ...restProps} = props;
return(
<button className={`bg-yellow text-black font-black text-xl px-6 py-5 hover:shadow-yellow ${className} `} {...restProps}>
</button>

)
}


export function ButtonGray(props){
const {className = '', ...restProps} = props;
return(

<Button className={`bg-grey hover:shadow-grey ${className}`} {...restProps}>
</Button>
)
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hola @X905 , sugiero mantener una consistencia en el nombraniento de los componentes, por ejemplo el CamelCase en las funciones sirve para identificar que son un Componente, y para el ambito de React que podes usar hooks y lo demás de la libreria,

Por ello es sugerible que para el caso de estos componentes, cada componente cómo Button y ButtonGray estén en un archivo nombrados de la misma mánera

Comment on lines 11 to 18
export function ButtonGray(props){
const {className = '', ...restProps} = props;
return(

<Button className={`bg-grey hover:shadow-grey ${className}`} {...restProps}>
</Button>
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semanticamente se entiende que este es un botón en gris, a diferencia de Button , que da entender que es solamente un botón, cuando la idea es tener 2 "sabores" del botón

export function Button(props){
const {className = '', ...restProps} = props;
return(
<button className={`bg-yellow text-black font-black text-xl px-6 py-5 hover:shadow-yellow ${className} `} {...restProps}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es sugerible no hacer un spread de las props restProps en el componente, en cambio sería mejor si las propiedades que este recibirá están detalladas con .propTypes, por ejemplo sabes que el botón tendrá un evento click, y en react la prop para los componentes para triggear el click es onClick

@D3Portillo D3Portillo linked an issue Sep 23, 2020 that may be closed by this pull request
4 tasks
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

Successfully merging this pull request may close these issues.

[BOOK] - Elaboración del componente Button
2 participants