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

Remove MainTheme #685

Merged
merged 6 commits into from
Dec 19, 2019
Merged

Remove MainTheme #685

merged 6 commits into from
Dec 19, 2019

Conversation

bpierre
Copy link
Contributor

@bpierre bpierre commented Dec 12, 2019

This is the main commit: https://github.com/aragon/aragon-ui/commit/34993b5ad38448da77cc25d07e801ba5b470b341

MainTheme has been removed and should be implemented on the app side if
needed (see devbox/components/current-theme.js or devbox/apps/Theme.js
for examples).

This is because having sub themes in an app is not something people use
at the moment, and being able to set the main theme as a prop makes
things easier to manage for custom themes.

Custom themes are also always extending the base theme corresponding to
their appearance, making the process of extending themes a bit easier.

MainTheme has been removed and should be implemented on the app side if
needed (see devbox/components/current-theme.js or devbox/apps/Theme.js
for examples).

This is because having sub themes in an app is not something people use
at the moment, and being able to set the main theme as a prop makes
things easier to manage for custom themes.

Custom themes are also always extending the base theme corresponding to
their appearance, making the process of extending themes a bit easier.
@rperez89
Copy link
Contributor

Any news on this ?

Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

We've been discussing offline how to deal with Main.

For now, let's go with what's available in this PR'; I assume all apps implementing dark mode will have to provide the value from useGuiStyle() to their Main declarations.

In the future, I think the best API for Main is to keep these props as strict "overrides" (so the current API is still useful), but change the defaults based on the context. In the case of an Aragon App, perhaps we can base the layout behaviour based on the UI services provided (or some other mechanism).

src/components/Main/README.md Outdated Show resolved Hide resolved
if (typeof theme === 'string' && EMBEDDED_THEMES[theme]) {
return EMBEDDED_THEMES[theme]
}
return theme

if (theme === EMBEDDED_THEMES[theme._name]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to check deep equality here against all keys, or comment that we're only interested in this particular shortcut.

Copy link
Contributor Author

@bpierre bpierre Dec 19, 2019

Choose a reason for hiding this comment

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

I’m not sure I follow, do you mean checking against another entry in a theme? The idea here is just to check if the requested theme is available in the embedded ones (basically, is it light or dark). The only accepted value would be one that correspond to the _name of the theme.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just worried you'll use a different object reference for theme, even if the theme is the exact same.

The idea here is just to check if the requested theme is available in the embedded ones (basically, is it light or dark). The only accepted value would be one that correspond to the _name of the theme.

Would if (EMBEDDED_THEMES[theme._name]) work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right! Sorry I was mistaking with the previous check on the name 😐

Would if (EMBEDDED_THEMES[theme._name]) work?

Yes! And I’m thinking now that we might want to remove this entirely? If someone passes a theme that has the same name than one of the embedded ones, we probably want to use the one being passed anyway?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I think so too.

}
<Main theme={theme}>
<Header primary="Theme" />
<Bar primary={<BackButton />} secondary={<Button label="Share" />} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could remove the share button for now, since it doesn't do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is more to preview the theme, rather than having the components do something :-)

@@ -1,140 +1,48 @@
import React from 'react'
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this new Theme page; maybe we can just consolidate the Color and Theme pages together?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It’s really to develop, it’s not meant to be public. I’m thinking about maybe evolving it as a theme editor at some point, but for now it’s a q&d preview of a theme.

@bpierre
Copy link
Contributor Author

bpierre commented Dec 19, 2019

In the future, I think the best API for Main is to keep these props as strict "overrides" (so the current API is still useful), but change the defaults based on the context. In the case of an Aragon App, perhaps we can base the layout behaviour based on the UI services provided (or some other mechanism).

Yes, totally agree on keeping both ways to set a theme.

@bpierre bpierre merged commit ff830cc into master Dec 19, 2019
@bpierre bpierre deleted the theme-update-2 branch December 19, 2019 19:16
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.

3 participants