gameday-guru / gdg-component-library

2 stars 2 forks source link

CR: Button #1

Open l-monninger opened 2 years ago

l-monninger commented 2 years ago

Implement roughly the same button you did in our exercises. The spec is as follows:

Spec:

Spec draftsheet

Suggestions:

l-monninger commented 2 years ago

Mapping

Lol, dude... This made me chuckle

export const variantMap = Variants.map((Variant) => VARIANT_STYLES);

.map is a container method to transform an array of values to another array of values.

What you need is to map variants using an object that has keys which are the variants, and styles values which are the styles. What I was suggesting above is that you do something like this.

{

    do : [['green', 'white', 'gray'], ['white', 'green', 'gray']]

}

The first three entries are for the button displaying statically. The second three could either be for the button under hover, or the button when inverted. We you get this closer to done, we'll talk through how to project this down into the design system.

Button organization

I didn't give you the exact place to store the button as a bit of a puzzle. components/navigation is not where it should go. And, it was a bit of trick question because the exact folder does not yet exist. It should be components/input/unary/Button. Can you guess why?

Code organization

You've got way too many if statements for this one my dude. Learn how to do the mapping above, and you should be able to figure out how to trim this down.