Skip to content

Commit

Permalink
Css login fix (#2573)
Browse files Browse the repository at this point in the history
* Set cds-theme when the state changes

* Fix vertical overflow
  • Loading branch information
antgamdia committed Mar 18, 2021
1 parent 947cd07 commit c946391
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions dashboard/src/components/LoginForm/LoginForm.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
#login-submit-button {
display: block;
}

div .login-wrapper .login {
min-height: 100%;
}
10 changes: 8 additions & 2 deletions dashboard/src/reducers/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getType } from "typesafe-actions";
import actions from "../actions";
import { ConfigAction } from "../actions/config";
import { IConfig, SupportedThemes } from "../shared/Config";
import Config, { IConfig } from "../shared/Config";

export interface IConfigState extends IConfig {
loaded: boolean;
Expand All @@ -17,7 +17,7 @@ export const initialState: IConfigState = {
oauthLogoutURI: "",
authProxySkipLoginPage: false,
clusters: [],
theme: (localStorage.getItem("theme") as SupportedThemes) || SupportedThemes.light,
theme: Config.getTheme(),
};

const configReducer = (state: IConfigState = initialState, action: ConfigAction): IConfigState => {
Expand All @@ -30,6 +30,12 @@ const configReducer = (state: IConfigState = initialState, action: ConfigAction)
loaded: true,
...action.payload,
};
case getType(actions.config.receiveTheme):
Config.setTheme(action.payload);
return {
...state,
theme: action.payload,
};
case getType(actions.config.setThemeState):
return {
...state,
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/shared/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class Config {
}

public static setTheme(theme: SupportedThemes) {
document.body.setAttribute("cds-theme", theme);
localStorage.setItem("theme", theme);
}

Expand Down

0 comments on commit c946391

Please sign in to comment.