-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Core] reorg internal modules #3682
Conversation
@mbrookes Wow awesome work 😍 😍 Thanks a lot 👍 👍 |
This looks good to me. And I'm happy with common. |
I don't like The capitalization looks weird, and the name of the component is weird. Using that logic, we should also have a Additionally, this has brought up an interesting point RE api design amongst components with variations such as this. Let's look at button as an example. Rather than having a I'm not arguing one way or the other here -- just presenting the thought. |
My hope is that we'll end up with I think different components should be used for different behaviour, rather than for different formatting, and FlatButton seems like a styling concern...? I quite like |
@chrismcv I'm on the same page with regards to styling concerns vs behaviour differences. I didn't know you could "scope" behaviour like that (with a period), how is it implemented? Also, with regards to the current name |
While we're deciding what to rename Having |
@nathanmarks - I think the following should work. We use it es5 style atm.
|
@chrismcv Eeek, I don't like mixing es6 import/export syntax and es5 usage like that. |
@mbrookes Yeah, I disliked seeing this:
|
@chrismcv I think that a decision should be made on how to design component APIs with regards to raised/flat buttons and regular/multiline textfield, etc. That will dictate the naming. |
In my own projects, I like keeping my code that isn't necessarily specific to React (ie, most of what about: src/
internal/ # shared/internal components
utils/ # utils n shit
Component.js
ShitComponent.js
index.js (personally, I have |
@nathanmarks fair enough... shall we open a separate issue for that, so as not to take this PR OT? |
@chrismcv Yeah for sure, I was planning on opening it at some point tonight actually when I stop being scatterbrained. |
@nathanmarks That can be achieved with static members: class A extends Component {
...
}
A.B = class B extends Component {
...
} |
After much discussion with @nathanmarks, and subsequently with @alitaheri, here's what we've come up with:
So:
And in addition, that internal subcomponents that are collocated with their parent component go in an
This hopefully strikes the right balance between ease of import of public components, a meaningful structure and the least amount of visible change. |
@mbrookes do you think we need the |
@mbrookes @nathanmarks If we flatten the structure:
We might not need it. But what if we have other
Then it gets confusing! I like nested |
I hadn't considered moving the public subcomponents out of their parent - I'll have to think about that one, but @nathanmarks the very reason for the inclusion of Since we want to group non-shared internal components with their respective parents, putting them in an internal directory adds clarity, not noise. |
I think if we agree to it, I will tackle per-component |
One thing to consider in the internal folder vs no internal folder debate is where tests are going to reside. I agree with @mbrookes though regarding not having to decide on the internal bit in our first round of migrations. Let's focus on fixing the public import paths first, and we can organize private stuff when we understand better how it's turning out. |
@callemall/material-ui take a quick look at this |
@newoga - I was talking specifically about the per-component Tidying up There's been lots talk, but no action. Lets get this done once alpha.2 is out the door. |
Closing in favour of #3749 which continues this. |
This was my take on reorganising the internal modules. Pretty much everything is done, apart from
styles
, which I've mostly left alone for now until we decide our approach to themes in #3678.src/utils
to/src/common
& deleteindex.js
.src/mixins/*
tosrc/common/
(these are going, but no need to keep the directory around).src/common/components/
.*src/InkBar.jsx
tosrc/tabs/InkBar.jsx
.src/enhanced-texarea.jsx
tosrc/TextField/TextFieldTextarea.jsx
./src/styles/getMuiTheme.js
tosrc/getMuiTheme.js
& deprecate old export path.src/styles/colors.js
tosrc/styles/colors.js
Exports in the oldcolors.js
aren't deprecated yet. (Hoping there's a low overhead way of doing that!)src/index.js
to remove non-public exports.src
.docs
.tests
.*While common components are currently grouped in
src/common/components
, this can be flattened intosrc/common/
if preferred, or could be a sibling directory in/src
.This hopefully covers most of #3670 (pending a decision on the final name for
internal
- Edit: I've usedcommon
for now.).@alitaheri - sorry this doesn't directly continue from your good work, but we both started on this in parallel. I guess we were both keen to see this happen ASAP! 😁 (And I updated this to benefit from the discussion there.)
@callemall/material-ui - hope you like! 😅