Skip to content

Conversation

@DDunc
Copy link
Contributor

@DDunc DDunc commented Jun 5, 2018

*bgImageStyle prop allows for setting the backgroundImage property directly (resolve #428)
*bgLighten prop allows for setting opacity with white instead black (based on #531, happy to rebase/refactor for the bgLighten warning)
*Refactor for greater purity/granularity/testability
*Disabled consistent-return for base.js. This seems like an Airbnb rule that's part of a larger discussion about expectations of implicit returns, but would add a lot of boilerplate here.
*Validated that old and new getStyles functions return the same objects/trigger the same one time warnings but some tests would still be a good idea.

@DDunc DDunc force-pushed the feature/add-bg-image-style branch 2 times, most recently from 176bb87 to ba85d3b Compare June 5, 2018 17:42
@DDunc DDunc force-pushed the feature/add-bg-image-style branch from ba85d3b to fa9fa4a Compare June 6, 2018 02:29
Copy link
Member

@ryan-roemer ryan-roemer left a comment

Choose a reason for hiding this comment

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

Looks like a good start here. Tests are failing in CI, but assuming that's on the task list to fix too.

export const buildStyles = (transforms, props, context, styles = {}) => {
return transforms.reduce((av, cv) => {
return { ...av, ...cv(props, context, av) };
}, styles);
Copy link
Member

Choose a reason for hiding this comment

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

Did we want to mutate the styles object passed into us?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're using styles as an initial value and returning a new value, I don't think it would be expected behavior to have side effects.

}
};
export const transformBold = ({ bold }) => {
if (typeof italic === 'boolean') {
Copy link
Member

Choose a reason for hiding this comment

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

typeof italic? Looks like the wrong variable referenced.

Shouldn't lint catch this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would certainly prefer it to, but eslint no-undef skips typeof by default. After declaring"no-undef": ["error", { "typeof": true }] in the eslintrc and running it against all the project files it doesn't look like we're using that typeof 'feature' anywhere else.

@DDunc DDunc changed the title [WIP]move font-size and warn utils out of base, add bgLighten and bgImageStyle Move font-size and warn utils out of base, refactor conditionals, add bgImageStyle Sep 19, 2018
@DDunc DDunc force-pushed the feature/add-bg-image-style branch from 6e0d530 to 5fd5725 Compare September 19, 2018 00:08
@ebrillhart ebrillhart merged commit d58d6d0 into master Sep 20, 2018
@ebrillhart ebrillhart deleted the feature/add-bg-image-style branch September 20, 2018 03:52
ElreyB pushed a commit that referenced this pull request Sep 21, 2018
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.

bgImage prop should also support gradients

4 participants