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(react): adding ability to support theming of datahub, with two themes included OOB #2193

Merged
merged 14 commits into from
Mar 10, 2021

Conversation

gabe-lyons
Copy link
Contributor

Light theme:
image

image

image

Dark theme:
image
image
image

Instructions on how to use in the readme

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@shirshanka
Copy link
Contributor

@gabe-lyons : looks like there is a build issue

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

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

Slick! LGTM :)

@shirshanka shirshanka merged commit 9238701 into datahub-project:master Mar 10, 2021
@@ -43,6 +47,14 @@ const client = new ApolloClient({
});

const App: React.VFC = () => {
const [dynamicThemeConfig, setDynamicThemeConfig] = useState<Theme | null>(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just set this to default?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see - is the idea that you can specify a "partial" theme that just overrides the default? This makes sense

const themeConfig = dynamicThemeConfig || defaultThemeConfig;
Object.assign(overridesWithoutPrefix, themeConfig.styles);
Object.keys(overridesWithoutPrefix).forEach((key) => {
overridesWithoutPrefix[key.substring(1)] = overridesWithoutPrefix[key];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we remove the "@" here... what if people don't use the @ when they specify styles?

)}
</EntityRegistryContext.Provider>
</Router>
<ThemeProvider theme={theme}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome!

@@ -38,7 +38,7 @@ export const BrowseResults = ({
const entityRegistry = useEntityRegistry();
return (
<div>
<Content style={{ backgroundColor: 'white', padding: '25px 100px' }}>
<Content style={{ padding: '25px 100px' }}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we extract inline styling?

padding: 40px 100px;
`;

const BodyContainer = styled.div`
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is great!

@@ -0,0 +1,32 @@
{
"styles": {
"@border-radius-base": "4px",
Copy link
Collaborator

Choose a reason for hiding this comment

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

If someone overrides as "border-radius-base", will this still work?

I still feel the @ convention is a bit confusing

"assets": {
"logoUrl": "/assets/logo.png"
},
"content": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Really like that everything is in one place.

@@ -0,0 +1,32 @@
export type Theme = {
styles: {
'border-radius-base': string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't these require the @ guy?

Copy link
Collaborator

@jjoyce0510 jjoyce0510 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 awesome!!!! Great work @gabe-lyons.

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