Skip to content

button component#4

Open
X905 wants to merge 2 commits intonodeschoolsm:masterfrom
X905:master
Open

button component#4
X905 wants to merge 2 commits intonodeschoolsm:masterfrom
X905:master

Conversation

@X905
Copy link

@X905 X905 commented Sep 22, 2020

  • Sabor primary del boton
  • Sabor secondary del boton

@D3Portillo D3Portillo self-requested a review September 23, 2020 09:44
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