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

fix: ui dark theme transition #12068

Merged
merged 4 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
text-align: right;
label {
padding-right: 2em;
@include themify($themes) {
color: themed('text-2');
}
color: $argo-color-gray-8;
Copy link
Contributor

@keithchong keithchong Feb 21, 2023

Choose a reason for hiding this comment

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

Question: does this apply for light mode only? (Or, maybe this should not be part of the fix?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it is not related to transition, just a small fix related to compact diff menu
image

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 does relate to dark/light mode change

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, the text was not showing.

}
}
&__diff {
Expand Down
3 changes: 3 additions & 0 deletions ui/src/app/shared/components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ export interface LayoutProps {
isExtension?: boolean;
}

const getBGColor = (theme: string): string => (theme === 'light' ? '#dee6eb' : '#100f0f');

Copy link
Contributor

Choose a reason for hiding this comment

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

This could be simplified to one line. Also can we use existing colors for the new two colors? For example, ARGO_GRAY4_COLOR is very similar to #dee6eb. Better we don't add more colors to the existing color library.

Suggested change
const getBGColor = (theme: string): string => theme === 'light' ? '#dee6eb' : '#100f0f';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved, thanks Yi
I have used the color codes from the existing color library - can't use the name in .tsx file as argo-ui can't be imported.

export const Layout = (props: LayoutProps) => (
<div className={props.pref.theme ? 'theme-' + props.pref.theme : 'theme-light'}>
<div className={`cd-layout ${props.isExtension ? 'cd-layout--extension' : ''}`}>
<Sidebar onVersionClick={props.onVersionClick} navItems={props.navItems} pref={props.pref} />
{props.pref.theme ? (document.body.style.background = getBGColor(props.pref.theme)) : null}
Copy link

Choose a reason for hiding this comment

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

@saumeya But this will output the color to the body and break the layout.

image

image

<div className={`cd-layout__content ${props.pref.hideSidebar ? 'cd-layout__content--sb-collapsed' : 'cd-layout__content--sb-expanded'} custom-styles`}>
{props.children}
</div>
Expand Down