Skip to content

Commit

Permalink
Move General user settings styles to more specific places
Browse files Browse the repository at this point in the history
This was w grab bag of styles for the email/phone components and
one for something now in preferences. Move them elsewhere so I can
rename the tab sensibly.
  • Loading branch information
dbkr committed Aug 1, 2024
1 parent 9cd0c24 commit 77062ac
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 38 deletions.
3 changes: 2 additions & 1 deletion res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@import "./components/views/messages/shared/_MediaProcessingError.pcss";
@import "./components/views/pips/_WidgetPip.pcss";
@import "./components/views/polls/_PollOption.pcss";
@import "./components/views/settings/_EmailAddressesPhoneNumbers.pcss";
@import "./components/views/settings/devices/_CurrentDeviceSection.pcss";
@import "./components/views/settings/devices/_DeviceDetailHeading.pcss";
@import "./components/views/settings/devices/_DeviceDetails.pcss";
Expand Down Expand Up @@ -356,10 +357,10 @@
@import "./views/settings/tabs/room/_RolesRoomSettingsTab.pcss";
@import "./views/settings/tabs/room/_SecurityRoomSettingsTab.pcss";
@import "./views/settings/tabs/user/_AppearanceUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_GeneralUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_HelpUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_KeyboardUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_MjolnirUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_PreferencesUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_SecurityUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_SidebarUserSettingsTab.pcss";
@import "./views/spaces/_SpaceBasicSettings.pcss";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright 2019 New Vector Ltd
Copyright 2024 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.
Expand All @@ -14,28 +15,23 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_GeneralUserSettingsTab_section--discovery_existing {
/*
* These used to live in Generl User Settings. These components are horrily duplicative
* but share the same styles. For now I'm putting them here so I can renamed the general
* tab sensibly and before I can refactor these components.
*/

.mx_EmailAddressesPhoneNumbers_discovery_existing {
display: flex;
align-items: center;
}

.mx_GeneralUserSettingsTab_section--discovery_existing_address,
.mx_GeneralUserSettingsTab_section--discovery_existing_promptText {
.mx_EmailAddressesPhoneNumbers_discovery_existing_address,
.mx_EmailAddressesPhoneNumbers_discovery_existing_promptText {
flex: 1;
margin-right: 10px;
}

.mx_GeneralUserSettingsTab_section--discovery_existing_button {
.mx_EmailAddressesPhoneNumbers_discovery_existing_button {
margin-left: 5px;
}

.mx_GeneralUserSettingsTab_warningIcon {
vertical-align: middle;
margin-right: $spacing-8;
margin-bottom: 2px;
}

.mx_GeneralUserSettingsTab_section_hint {
font: var(--cpd-font-body-sm-regular);
color: var(--cpd-color-text-secondary);
}
21 changes: 21 additions & 0 deletions res/css/views/settings/tabs/user/_PreferencesUserSettingsTab.pcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2019 New Vector Ltd
Copyright 2024 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_EmailAddressesPhoneNumbers_section_hint {
font: var(--cpd-font-body-sm-regular);
color: var(--cpd-color-text-secondary);
}
12 changes: 6 additions & 6 deletions src/components/views/settings/account/EmailAddresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,21 @@ export class ExistingEmailAddress extends React.Component<IExistingEmailAddressP
public render(): React.ReactNode {
if (this.state.verifyRemove) {
return (
<div className="mx_GeneralUserSettingsTab_section--discovery_existing">
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_promptText">
<div className="mx_EmailAddressesPhoneNumbers_discovery_existing">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_promptText">
{_t("settings|general|remove_email_prompt", { email: this.props.email.address })}
</span>
<AccessibleButton
onClick={this.onActuallyRemove}
kind="danger_sm"
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
>
{_t("action|remove")}
</AccessibleButton>
<AccessibleButton
onClick={this.onDontRemove}
kind="link_sm"
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
>
{_t("action|cancel")}
</AccessibleButton>
Expand All @@ -120,8 +120,8 @@ export class ExistingEmailAddress extends React.Component<IExistingEmailAddressP
}

return (
<div className="mx_GeneralUserSettingsTab_section--discovery_existing">
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_address">
<div className="mx_EmailAddressesPhoneNumbers_discovery_existing">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_address">
{this.props.email.address}
</span>
<AccessibleButton onClick={this.onRemove} kind="danger_sm" disabled={this.props.disabled}>
Expand Down
12 changes: 6 additions & 6 deletions src/components/views/settings/account/PhoneNumbers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ export class ExistingPhoneNumber extends React.Component<IExistingPhoneNumberPro
public render(): React.ReactNode {
if (this.state.verifyRemove) {
return (
<div className="mx_GeneralUserSettingsTab_section--discovery_existing">
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_promptText">
<div className="mx_EmailAddressesPhoneNumbers_discovery_existing">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_promptText">
{_t("settings|general|remove_msisdn_prompt", { phone: this.props.msisdn.address })}
</span>
<AccessibleButton
onClick={this.onActuallyRemove}
kind="danger_sm"
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
>
{_t("action|remove")}
</AccessibleButton>
<AccessibleButton
onClick={this.onDontRemove}
kind="link_sm"
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
>
{_t("action|cancel")}
</AccessibleButton>
Expand All @@ -116,8 +116,8 @@ export class ExistingPhoneNumber extends React.Component<IExistingPhoneNumberPro
}

return (
<div className="mx_GeneralUserSettingsTab_section--discovery_existing">
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_address">
<div className="mx_EmailAddressesPhoneNumbers_discovery_existing">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_address">
+{this.props.msisdn.address}
</span>
<AccessibleButton onClick={this.onRemove} kind="danger_sm" disabled={this.props.disabled}>
Expand Down
10 changes: 5 additions & 5 deletions src/components/views/settings/discovery/EmailAddresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
<span>
{_t("settings|general|discovery_email_verification_instructions")}
<AccessibleButton
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
kind="primary_sm"
onClick={this.onContinueClick}
disabled={this.state.continueDisabled}
Expand All @@ -190,7 +190,7 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
} else if (bound) {
status = (
<AccessibleButton
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
kind="danger_sm"
onClick={this.onRevokeClick}
disabled={this.props.disabled}
Expand All @@ -201,7 +201,7 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
} else {
status = (
<AccessibleButton
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
kind="primary_sm"
onClick={this.onShareClick}
disabled={this.props.disabled}
Expand All @@ -212,8 +212,8 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
}

return (
<div className="mx_GeneralUserSettingsTab_section--discovery_existing">
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_address">{address}</span>
<div className="mx_EmailAddressesPhoneNumbers_discovery_existing">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_address">{address}</span>
{status}
</div>
);
Expand Down
10 changes: 5 additions & 5 deletions src/components/views/settings/discovery/PhoneNumbers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
let status;
if (verifying) {
status = (
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_verification">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_verification">
<span>
{_t("settings|general|msisdn_verification_instructions")}
<br />
Expand All @@ -200,7 +200,7 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
} else if (bound) {
status = (
<AccessibleButton
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
kind="danger_sm"
onClick={this.onRevokeClick}
disabled={this.props.disabled}
Expand All @@ -211,7 +211,7 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
} else {
status = (
<AccessibleButton
className="mx_GeneralUserSettingsTab_section--discovery_existing_button"
className="mx_EmailAddressesPhoneNumbers_discovery_existing_button"
kind="primary_sm"
onClick={this.onShareClick}
disabled={this.props.disabled}
Expand All @@ -222,8 +222,8 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
}

return (
<div className="mx_GeneralUserSettingsTab_section--discovery_existing">
<span className="mx_GeneralUserSettingsTab_section--discovery_existing_address">+{address}</span>
<div className="mx_EmailAddressesPhoneNumbers_discovery_existing">
<span className="mx_EmailAddressesPhoneNumbers_discovery_existing_address">+{address}</span>
{status}
</div>
);
Expand Down

0 comments on commit 77062ac

Please sign in to comment.