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

feat(Card): add textAlign prop to Card subcomponents #2038

Merged
merged 7 commits into from
Sep 11, 2017
Merged

feat(Card): add textAlign prop to Card subcomponents #2038

merged 7 commits into from
Sep 11, 2017

Conversation

itamar244
Copy link
Contributor

@itamar244 itamar244 commented Sep 1, 2017

Fixes #2027

@itamar244 itamar244 closed this Sep 1, 2017
@itamar244 itamar244 changed the title feat(Card): add textAlign prop to CardContent feat(Card): add textAlign prop to Card subcomponents Sep 1, 2017
@itamar244 itamar244 reopened this Sep 1, 2017
@itamar244 itamar244 changed the title feat(Card): add textAlign prop to Card subcomponents feat(Card): add textAlign prop to Card subcomponents (#2027) Sep 1, 2017
@codecov-io
Copy link

codecov-io commented Sep 1, 2017

Codecov Report

Merging #2038 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2038   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files         148      148           
  Lines        2561     2561           
=======================================
  Hits         2555     2555           
  Misses          6        6
Impacted Files Coverage Δ
src/views/Card/CardContent.js 100% <ø> (ø) ⬆️
src/views/Card/CardGroup.js 100% <100%> (ø) ⬆️
src/views/Card/CardMeta.js 100% <100%> (ø) ⬆️
src/views/Card/CardHeader.js 100% <100%> (ø) ⬆️
src/views/Card/CardDescription.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f39631...399c832. Read the comment docs.

@itamar244 itamar244 changed the title feat(Card): add textAlign prop to Card subcomponents (#2027) feat(Card): add textAlign prop to Card subcomponents Sep 1, 2017
@itamar244
Copy link
Contributor Author

itamar244 commented Sep 2, 2017

ready for a merge

Copy link
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

@itamar244 Thanks for PR 👍 I've add some comments

@@ -24,5 +24,6 @@ describe('CardContent', () => {
mapValueToProps: val => ({ content: val }),
})

common.implementsTextAlignProp(CardContent, ['left', 'center', 'right'])
Copy link
Member

Choose a reason for hiding this comment

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

Lets use _.without(SUI.TEXT_ALIGNMENTS, 'justified') in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe a new constant equals to ['left', 'center', 'right'] is needed?
It is smaller when bundling and faster.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that there is real necessity. This code doesn't work in production builds.

@@ -26,11 +27,13 @@ function CardGroup(props) {
items,
itemsPerRow,
stackable,
textAlign,
} = props

const classes = cx('ui',
Copy link
Member

Choose a reason for hiding this comment

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

Lets add newline there:

-const classes = cx('ui',
+const classes = cx(
+  'ui',

const { children, className, content } = props
const classes = cx(className, 'meta')
const { children, className, content, textAlign } = props
const classes = cx(className, useTextAlignProp(textAlign), 'meta')
Copy link
Member

Choose a reason for hiding this comment

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

Lets make this multiline:

const classes = cx(
  className, 
  useTextAlignProp(textAlign),
   'meta',
)

} = props

const classes = cx(
className,
useKeyOnly(extra, 'extra'),
useTextAlignProp(textAlign),
'content',
)
Copy link
Member

Choose a reason for hiding this comment

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

As we update almost all Card components, lets also move className to end, it's one of our style rules. I overlooked this on initial review.

cx(
  useKeyOnly(extra, 'extra'),
  useTextAlignProp(textAlign),
   'content',
  className,
)	

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should i first write 'ui', then functions, then other literals and then className?

@@ -1,3 +1,6 @@
import _ from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

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

Heads up, tests are failing due to lint:

/home/ubuntu/Semantic-UI-React/test/specs/views/Card/CardContent-test.js
  1:23  error  Extra semicolon  semi

You can run npm run lint:fix to fix most errors and then push. Note that you can ignore warnings.

Copy link
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

@itamar244 Thanks, awesome work 👍

@levithomason levithomason merged commit 1fa93b2 into Semantic-Org:master Sep 11, 2017
@levithomason
Copy link
Member

You guys are great! Thanks again @layershifter for always filling in for me ❤️

@levithomason
Copy link
Member

Released in semantic-ui-react@0.73.0

layershifter pushed a commit that referenced this pull request Sep 11, 2017
* feat(Card): add textAlign prop to CardContent

* feat(Card): add textAlign to all Card subcomponents

* styles(Card): fix code style inconsistencies

* refactor(Card): change array literals functions calls

* fix(Card): fix lint errors

* style(Card): fix classes order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants