-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Styles] Prefer Anonymous Default Export Pattern #903
Conversation
…mponent as sibling to others
@@ -2,26 +2,17 @@ import React from 'react'; | |||
import PropTypes from 'prop-types'; | |||
import { useTheme } from 'emotion-theming'; | |||
|
|||
import Loader from './shared-components/loader'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only change in this file is the relative import paths changing, and removing the importing/exporting of other non-Button buttons
@@ -1,8 +1,8 @@ | |||
import React from 'react'; | |||
|
|||
import { RoundButton } from '../../button'; | |||
import { RoundButton } from '../../button/components/roundButton'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes incidentally make exports like this clearer, too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I love the standarization, it looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:thumbs forgot to click on Approve
export const
styled component exports to conform to our anonymousexport default
preference.radiance-ui
is that anyone can import these styled components directly fromradiance-ui/lib
. This change requires people to import the style file default export first, which makes it less likely people will do that.src/shared-components/button
. Right now it's disorderly: the Button component itself imports (and exports) the other Button components, its style file is mostly shared styles, and anecdotally making changes to these components is always thorny due to the interconnectedness./components
sub-directory, to be a sibling of our other Button-like components. It maintains files atsrc/shared-components/button
for shared styles and types, and exports the 5 buttons thatsrc/shared-components/index.ts
also exports to make it available to the bundle.The size changes in the bundle is mostly because the non-production source map slug is longer (in the Accordion, it's 5066 characters vs. 4950), which wouldn't be reflected in our production bundles. Rollup also moves the anonymous default export into a
var Style
declaration that creates a tiny bit of additional overhead.Due to the changing export pattern, releasing this will require a breaking change in order to also remove imports like
import { OuterContainer } from 'radiance-ui/lib/shared-components/selectorButton/style';
and find some other way to achieve the same behavior.