Compare commits

...

9 Commits

Author SHA1 Message Date
David Baker
660aa52a21 Set align-items to normal
As center affected the list items too. Also add it to the flex
component because it didn't have it as an option.
2025-02-19 11:41:15 +00:00
David Baker
18c480ac6e Snaspshots again 2025-02-19 11:00:51 +00:00
David Baker
8e7188467b Fix justification 2025-02-19 10:59:13 +00:00
David Baker
e2275c54c7 Also use gap prop and update snapshots 2025-02-19 09:52:48 +00:00
David Baker
aaa06a5b9b Use flex component 2025-02-19 09:37:47 +00:00
David Baker
a3474b479c Do it the other way
Because we only want it in the destructive cards, not the other ones.
2025-02-18 18:44:02 +00:00
David Baker
487ac47717 Update snapshot 2025-02-18 18:21:06 +00:00
David Baker
5e4af8cffb Update snapshot 2025-02-18 18:10:47 +00:00
David Baker
11fa08e486 Move CSS for ResetIdentityPanel into EncryptionCard
This allows it to be re-used in other components. It's a *bit* magic
that EncryptionCard applies style to divs within it, although it
somewhat makes sense that it wants them styled a particular way.
The alternative would be to add another component for a div child of
encryption card like EncryptionCardButtons that just makes it flexbox
and centered: I'm not sure which is better.
2025-02-18 18:06:40 +00:00
8 changed files with 54 additions and 30 deletions

View File

@@ -360,8 +360,8 @@
@import "./views/settings/encryption/_AdvancedPanel.pcss";
@import "./views/settings/encryption/_ChangeRecoveryKey.pcss";
@import "./views/settings/encryption/_EncryptionCard.pcss";
@import "./views/settings/encryption/_EncryptionCardEmphasisedContent.pcss";
@import "./views/settings/encryption/_RecoveryPanelOutOfSync.pcss";
@import "./views/settings/encryption/_ResetIdentityPanel.pcss";
@import "./views/settings/tabs/_SettingsBanner.pcss";
@import "./views/settings/tabs/_SettingsIndent.pcss";
@import "./views/settings/tabs/_SettingsSection.pcss";

View File

@@ -0,0 +1,13 @@
/*
* Copyright 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
.mx_EncryptionCard_emphasisedContent {
span {
font: var(--cpd-font-body-md-medium);
text-align: center;
}
}

View File

@@ -1,19 +0,0 @@
/*
* Copyright 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
.mx_ResetIdentityPanel {
.mx_ResetIdentityPanel_content {
display: flex;
flex-direction: column;
gap: var(--cpd-space-3x);
> span {
font: var(--cpd-font-body-md-medium);
text-align: center;
}
}
}

View File

@@ -33,7 +33,7 @@ type FlexProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any
* The alignment of the flex children
* @default start
*/
align?: "start" | "center" | "end" | "baseline" | "stretch";
align?: "start" | "center" | "end" | "baseline" | "stretch" | "normal";
/**
* The justification of the flex children
* @default start

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
* Please see LICENSE files in the repository root for full details.
*/
import React, { type PropsWithChildren } from "react";
import { Flex } from "../../../utils/Flex";
/**
* A component for emphasised text within an {@link EncryptionCard}
* (mostly as somewhere for the common CSS to live).
*/
export function EncryptionCardEmphasisedContent({ children }: PropsWithChildren): JSX.Element {
return (
<Flex
direction="column"
gap="var(--cpd-space-3x)"
align="normal"
className="mx_EncryptionCard_emphasisedContent"
>
{children}
</Flex>
);
}

View File

@@ -16,6 +16,7 @@ import { EncryptionCard } from "./EncryptionCard";
import { useMatrixClientContext } from "../../../../contexts/MatrixClientContext";
import { uiAuthCallback } from "../../../../CreateCrossSigning";
import { EncryptionCardButtons } from "./EncryptionCardButtons";
import { EncryptionCardEmphasisedContent } from "./EncryptionCardEmphasisedContent";
interface ResetIdentityPanelProps {
/**
@@ -59,9 +60,8 @@ export function ResetIdentityPanel({ onCancelClick, onFinish, variant }: ResetId
? _t("settings|encryption|advanced|breadcrumb_title_forgot")
: _t("settings|encryption|advanced|breadcrumb_title")
}
className="mx_ResetIdentityPanel"
>
<div className="mx_ResetIdentityPanel_content">
<EncryptionCardEmphasisedContent>
<VisualList>
<VisualListItem Icon={CheckIcon} success={true}>
{_t("settings|encryption|advanced|breadcrumb_first_description")}
@@ -74,7 +74,7 @@ export function ResetIdentityPanel({ onCancelClick, onFinish, variant }: ResetId
</VisualListItem>
</VisualList>
{variant === "compromised" && <span>{_t("settings|encryption|advanced|breadcrumb_warning")}</span>}
</div>
</EncryptionCardEmphasisedContent>
<EncryptionCardButtons>
<Button
destructive={true}

View File

@@ -55,7 +55,7 @@ exports[`<ResetIdentityPanel /> should display the 'forgot recovery key' variant
</ol>
</nav>
<div
class="mx_EncryptionCard mx_ResetIdentityPanel"
class="mx_EncryptionCard"
>
<div
class="mx_EncryptionCard_header"
@@ -83,7 +83,8 @@ exports[`<ResetIdentityPanel /> should display the 'forgot recovery key' variant
</h2>
</div>
<div
class="mx_ResetIdentityPanel_content"
class="mx_Flex mx_EncryptionCard_emphasisedContent"
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: normal; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-3x);"
>
<ul
class="_visual-list_4dcf8_17"
@@ -235,7 +236,7 @@ exports[`<ResetIdentityPanel /> should reset the encryption when the continue bu
</ol>
</nav>
<div
class="mx_EncryptionCard mx_ResetIdentityPanel"
class="mx_EncryptionCard"
>
<div
class="mx_EncryptionCard_header"
@@ -263,7 +264,8 @@ exports[`<ResetIdentityPanel /> should reset the encryption when the continue bu
</h2>
</div>
<div
class="mx_ResetIdentityPanel_content"
class="mx_Flex mx_EncryptionCard_emphasisedContent"
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: normal; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-3x);"
>
<ul
class="_visual-list_4dcf8_17"

View File

@@ -226,7 +226,7 @@ exports[`<EncryptionUserSettingsTab /> should display the reset identity panel w
</ol>
</nav>
<div
class="mx_EncryptionCard mx_ResetIdentityPanel"
class="mx_EncryptionCard"
>
<div
class="mx_EncryptionCard_header"
@@ -254,7 +254,8 @@ exports[`<EncryptionUserSettingsTab /> should display the reset identity panel w
</h2>
</div>
<div
class="mx_ResetIdentityPanel_content"
class="mx_Flex mx_EncryptionCard_emphasisedContent"
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: normal; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-3x);"
>
<ul
class="_visual-list_4dcf8_17"