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

Fix Caret theme getters #188

Merged
merged 29 commits into from
Aug 6, 2018
Merged

Fix Caret theme getters #188

merged 29 commits into from
Aug 6, 2018

Conversation

shawnbot
Copy link
Contributor

@shawnbot shawnbot commented Aug 6, 2018

@emplums I figured out the fix for your weird diff in #184. This is based on #187, but take a look and lmk if you think this looks right. Rather than calling themeGet(), this uses styled-system's style() function to create style functions that mimic how styled-system creates them. The updated snapshot demonstrates that this works.

@shawnbot shawnbot requested a review from emplums August 6, 2018 20:18

function CircleOcticon(props) {
const {size} = props
const {icon, ...rest} = props
return (
<FlexContainer {...rest} size={size} alignItems="center" justifyContent="center">
<Octicon icon={icon} />
<Octicon icon={icon} size={size} />
Copy link

Choose a reason for hiding this comment

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

Are these changes just random cleanup? or are they here from a merge or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one in particular is random cleanup. I noticed that the Octicon wasn't getting all the props it needs.

Copy link

Choose a reason for hiding this comment

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

Ok cool!

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.

This looks good to me! Curious why we are silencing the system prop tests vs deleting them? Are we planning on fixing them later?

@shawnbot
Copy link
Contributor Author

shawnbot commented Aug 6, 2018

@emplums my hope was that putting pending tests in place for components that hadn't been migrated, it'd be a single character change to enable the test once they are. 😄

function Caret(props) {
const {bg} = getBg(props)
const {borderColor} = getBorderColor(props)
const {borderWidth} = getBorderWidth(props)
Copy link
Contributor Author

@shawnbot shawnbot Aug 6, 2018

Choose a reason for hiding this comment

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

Note: when we switch to using the tagged template literals, we can implement all of this differently. For example:

export default styled(RenderSVG)`
  pointer-events: none;
  position: absolute;
  ${({edge, align, size}) => getPosition(edge, align, size)}
  ${({edge, align}) => getMargin(edge, align)}

  path:first-child { ${props => {{fill: bg(props).backgroundColor}}) }
  path:last-child {
    fill: none;
    ${({borderColor, borderWidth}) => ({stroke: borderColor, strokeWidth: borderWidth})}
  }
`

@@ -32,7 +34,7 @@ expect.extend({
const fn = systemProps[name]
return list.concat(Object.keys(fn.propTypes))
}, [])
const missing = expectedPropKeys.filter(key => !propKeys.has(key))
const missing = expectedPropKeys.filter(key => !propKeys.has(key)).filter(key => !ALIAS_PROP_TYPES.includes(key))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emplums this fixes the cryptic missing props in certain calls to expect().toImplementSystemProps(). Some were being set by aliases within styled-system, and they're not needed here.

@@ -31,4 +25,7 @@ CaretBox.defaultProps = {
position: 'relative'
}

export default withSystemProps(CaretBox, ['color'])
// we can set this because it "extends" Box implicitly
Copy link

Choose a reason for hiding this comment

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

Box isn't a system component yet, but I'll switch out Box for Block in #184

Copy link

Choose a reason for hiding this comment

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

Actually since this PR is still open, would you mind switching out Box for Block here?

Copy link

Choose a reason for hiding this comment

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

nevermind! I'm sleepy 😂 Since it's just rendering Box and Box is just rendering Block which does implement system props this is fine

emplums
emplums previously requested changes Aug 6, 2018
@@ -31,4 +25,7 @@ CaretBox.defaultProps = {
position: 'relative'
}

export default withSystemProps(CaretBox, ['color'])
// we can set this because it "extends" Box implicitly
Copy link

Choose a reason for hiding this comment

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

Actually since this PR is still open, would you mind switching out Box for Block here?

@emplums emplums dismissed their stale review August 6, 2018 22:09

nevermind!

@shawnbot shawnbot merged commit 2249714 into release-1.0.0-beta Aug 6, 2018
@shawnbot shawnbot deleted the fix-caret branch August 6, 2018 22:17
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