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

No chameleon; clearer Text, Heading, Block, and Box components #70

Merged
merged 9 commits into from
Jun 19, 2018

Conversation

shawnbot
Copy link
Contributor

At @emplums suggestion, I've refactored the Text, Heading, Block, and Box components to be much clearer and removed the chameleon() function, which was causing some confusion. I've also removed the classifier(), valueMapper(), and expander() functions from props.js, but kept stylizer() around for Block (and, I predict, other components).

Team, I'd love all your eyes on this if you have time to take a look! ❤️

@emplums emplums mentioned this pull request Jun 13, 2018
4 tasks
@shawnbot
Copy link
Contributor Author

FYI I haven't updated the docs on this branch because there aren't any relevant changes. The tests pass, so the output should be exactly the same.

@shawnbot shawnbot changed the base branch from release-0.0.4-beta to master June 18, 2018 19:38
@shawnbot shawnbot mentioned this pull request Jun 18, 2018
3 tasks
Copy link

@emplums emplums left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @shawnbot! I think it's much more readable and intuitive in this form, really appreciate your work here! ✨ Just left a few comments!

return values.filter((v, i) => values.indexOf(v) === i)
}

function getBorderClass(value) {
Copy link

Choose a reason for hiding this comment

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

This is maybe one for another PR, but what do you think about separating the border utilities into two different props? We could have border and borderColor? I think that would make reasoning with the prop a bit more intuitive on the user side & would make it easier to create classes here! It looks like the styleguide docs also encourage using two separate classes for border/border-top/etc and border color utilities

Copy link

Choose a reason for hiding this comment

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

Also curious if we need to allow people to pass in border={0}, and we instead make the Block component have no border by default?

round,
shadow,
...rest
} = map(props)
Copy link

Choose a reason for hiding this comment

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

Can we rename map to something like mapUtilityProps?

fg && `text-${fg}`,
position && `position-${position}`,
(typeof round === 'number') && `rounded-${round}`,
shadow && ((shadow === true) ? 'box-shadow' : `box-shadow-${shadow}`)
Copy link

Choose a reason for hiding this comment

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

What do you think about changing the shadow API here to accept small, medium, large, extra-large and then instead of accepting either a boolean or a string we can just accept strings and this line would be

shadow && ((shadow === 'small') ? 'box-shadow' : box-shadow-${shadow}`)?

...rest
} = map(props)

const {style} = stylize(rest)
Copy link

Choose a reason for hiding this comment

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

Is stylize here turning any extra props into inline styles? Curious what situations we're expecting to need this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's only passing along these props to style.

nowrap: 'no-wrap'
})
const fontSizeMap = {
0: 6,
Copy link

Choose a reason for hiding this comment

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

I know this wasn't introduced in this PR but curious why we are inverting the fontSize scale here?

@shawnbot
Copy link
Contributor Author

@emplums thanks for all of that feedback! Let's file it in an issue for follow-up and merge this as-is, so that props API changes can be implemented and tested separately. ✌️

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.

2 participants