Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Break ThemeChoicePanel into a separate component (#6998)
Browse files Browse the repository at this point in the history
* Break ThemeChoicePanel into a separate component

* Tests for ThemeChoicePanel

* i18n fixes

* Fix copyright for ThemeChoicePanel
  • Loading branch information
andybalaam authored Oct 20, 2021
1 parent d188d32 commit 4b903b9
Show file tree
Hide file tree
Showing 8 changed files with 508 additions and 230 deletions.
1 change: 1 addition & 0 deletions res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
@import "./views/settings/_SetIdServer.scss";
@import "./views/settings/_SetIntegrationManager.scss";
@import "./views/settings/_SpellCheckLanguages.scss";
@import "./views/settings/_ThemeChoicePanel.scss";
@import "./views/settings/_UpdateCheckButton.scss";
@import "./views/settings/tabs/_SettingsTab.scss";
@import "./views/settings/tabs/room/_GeneralRoomSettingsTab.scss";
Expand Down
88 changes: 88 additions & 0 deletions res/css/views/settings/_ThemeChoicePanel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_ThemeChoicePanel {
$radio-bg-color: $input-darker-bg-color;
color: $primary-content;

> .mx_ThemeSelectors {
display: flex;
flex-direction: row;
flex-wrap: wrap;

margin-top: 4px;
margin-bottom: 30px;

> .mx_RadioButton {
padding: $font-16px;
box-sizing: border-box;
border-radius: 10px;
width: 180px;

background: $radio-bg-color;
opacity: 0.4;

flex-shrink: 1;
flex-grow: 0;

margin-right: 15px;
margin-top: 10px;

font-weight: 600;
color: $muted-fg-color;

> span {
justify-content: center;
}
}

> .mx_RadioButton_enabled {
opacity: 1;

// These colors need to be hardcoded because they don't change with the theme
&.mx_ThemeSelector_light {
background-color: #f3f8fd;
color: #2e2f32;
}

&.mx_ThemeSelector_dark {
// 5% lightened version of 181b21
background-color: #25282e;
color: #f3f8fd;

> input > div {
border-color: $input-darker-bg-color;
> div {
border-color: $input-darker-bg-color;
}
}
}

&.mx_ThemeSelector_black {
background-color: #000000;
color: #f3f8fd;

> input > div {
border-color: $input-darker-bg-color;
> div {
border-color: $input-darker-bg-color;
}
}
}
}
}
}

72 changes: 0 additions & 72 deletions res/css/views/settings/tabs/user/_AppearanceUserSettingsTab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,78 +24,6 @@ limitations under the License.
}
}

.mx_AppearanceUserSettingsTab_themeSection {
$radio-bg-color: $input-darker-bg-color;
color: $primary-content;

> .mx_ThemeSelectors {
display: flex;
flex-direction: row;
flex-wrap: wrap;

margin-top: 4px;
margin-bottom: 30px;

> .mx_RadioButton {
padding: $font-16px;
box-sizing: border-box;
border-radius: 10px;
width: 180px;

background: $radio-bg-color;
opacity: 0.4;

flex-shrink: 1;
flex-grow: 0;

margin-right: 15px;
margin-top: 10px;

font-weight: 600;
color: $muted-fg-color;

> span {
justify-content: center;
}
}

> .mx_RadioButton_enabled {
opacity: 1;

// These colors need to be hardcoded because they don't change with the theme
&.mx_ThemeSelector_light {
background-color: #f3f8fd;
color: #2e2f32;
}

&.mx_ThemeSelector_dark {
// 5% lightened version of 181b21
background-color: #25282e;
color: #f3f8fd;

> input > div {
border-color: $input-darker-bg-color;
> div {
border-color: $input-darker-bg-color;
}
}
}

&.mx_ThemeSelector_black {
background-color: #000000;
color: #f3f8fd;

> input > div {
border-color: $input-darker-bg-color;
> div {
border-color: $input-darker-bg-color;
}
}
}
}
}
}

.mx_AppearanceUserSettingsTab_Advanced {
color: $primary-content;

Expand Down
Loading

0 comments on commit 4b903b9

Please sign in to comment.