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

refactor: move components src to corresponding packages folders #1224

Merged
merged 23 commits into from
Feb 11, 2020

Conversation

jonnybel
Copy link
Contributor

@jonnybel jonnybel commented Dec 17, 2019

Summary

Start moving some of the components from src/components/** to packages/components/**/src.

I'm keeping each component "move" on different commits, so it's easier to review and find errors.

Work in progress.

Components moved in this PR:

  • avatar
  • buttons (all buttons)
  • card
  • collapsible & collapsible motion
    ...
  • table (was already moved before this PR)

It will take a while to move all the components and fix the import paths and dependencies, so I'm opening this PR to be open to suggestions and remarks. Also for the VRTs to run and ensure everything is going well.

@vercel
Copy link

vercel bot commented Dec 17, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/commercetools/ui-kit/e4s98mpx3
✅ Preview: https://ui-kit-git-ja-move-components.commercetools.now.sh

Copy link
Member

@emmenko emmenko left a comment

Choose a reason for hiding this comment

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

I'm wondering if we can maybe flatten the list of packages? For instance, not having packages/buttons/* but instead packages/icon-button, and so on.

What do you think?

@jonnybel
Copy link
Contributor Author

I see. Should we also do it for all the Fields and Inputs components?

@emmenko
Copy link
Member

emmenko commented Dec 17, 2019

If we decide to, we should do it for all packages yes.

See for yourself maybe if the codebase is still readable with the packages flatten.

@jonnybel
Copy link
Contributor Author

jonnybel commented Dec 17, 2019

The list of folders gets really long and quite disorganised, especially because of the inputs and fields are many and won't be listed sequentially.

Personally, I think I prefer keeping the groups we have now, the same way as they are grouped together in Storybook. They're easier to find on the component tree and also easier to grasp how many of each "type" do exist (useful for when all the components of a certain "type" need to be refactored).

Unless we flatten components like:

fields/number-field
fields/password-field
fields/radio-field
...

into

fields-number-field
fields-password-field
fields-radio-field
...

This would at least keep sorted together... But honestly I still prefer keeping them grouped in folders.

@emmenko
Copy link
Member

emmenko commented Dec 17, 2019

Yeah ok let's go with that for now. Thanks for looking into it

@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { render } from '../../../test-utils';
import { PlusThinIcon } from '../../icons';
import { PlusThinIcon } from '@commercetools-uikit/icons';
Copy link
Contributor Author

@jonnybel jonnybel Dec 17, 2019

Choose a reason for hiding this comment

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

Wondering if these (in .spec.js and .story.js) should be added to devDependencies.

Copy link
Member

Choose a reason for hiding this comment

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

It's not necessary, the ui-kit packages are available anyway, the other deps can be added to the root package.json as dev deps

@emmenko
Copy link
Member

emmenko commented Feb 7, 2020

@jonnybel this has been open for a while. I can pick it up and get it ready to merge. We also don't need to migrate all components at once, we can do it step by step.

@emmenko
Copy link
Member

emmenko commented Feb 7, 2020

I rebased with master and fixed the readmes and packages setup. I think this should be good to go now.

@emmenko emmenko marked this pull request as ready for review February 7, 2020 13:36
@emmenko emmenko changed the title [WIP] refactor: move components src to corresponding packages folders refactor: move components src to corresponding packages folders Feb 7, 2020
@emmenko emmenko added 🙏 Status: Dev Review Waiting for technical reviews and removed 🚧 Status: WIP Work in progress labels Feb 7, 2020
Copy link
Member

@emmenko emmenko left a comment

Choose a reason for hiding this comment

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

This is good from my side. I suggest to merge this and continue the migration in separate steps.

@jonnybel
Copy link
Contributor Author

Yes, migrating all the components takes quite a while and I agree we could merge this for now and continue on another PR.

Thanks a lot for the additional fixes! 🙏

@kodiakhq kodiakhq bot merged commit b0cbd71 into master Feb 11, 2020
@kodiakhq kodiakhq bot deleted the ja-move-components branch February 11, 2020 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants