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

Commit 70510c5

Browse files
committed
adjust recovery key button size depending on text
Fixes element-hq/element-web#19511 Signed-off-by: Michael Weimann <[email protected]>
1 parent 92df0a3 commit 70510c5

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

Diff for: res/css/views/dialogs/security/_CreateSecretStorageDialog.scss

+22-8
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ limitations under the License.
7474
.mx_CreateSecretStorageDialog_primaryContainer {
7575
/* FIXME: plinth colour in new theme(s). background-color: $accent-color; */
7676
padding-top: 20px;
77+
78+
&.mx_CreateSecretStorageDialog_recoveryKeyPrimarycontainer {
79+
display: flex;
80+
justify-content: center;
81+
}
7782
}
7883

7984
.mx_CreateSecretStorageDialog_primaryContainer::after {
@@ -127,9 +132,7 @@ limitations under the License.
127132
}
128133

129134
.mx_CreateSecretStorageDialog_recoveryKeyContainer {
130-
width: 380px;
131-
margin-left: auto;
132-
margin-right: auto;
135+
display: inline-block;
133136
}
134137

135138
.mx_CreateSecretStorageDialog_recoveryKey {
@@ -141,18 +144,29 @@ limitations under the License.
141144
border-radius: 6px;
142145
word-spacing: 1em;
143146
margin-bottom: 20px;
147+
148+
code {
149+
display: inline-block;
150+
width: 30rem;
151+
}
144152
}
145153

146154
.mx_CreateSecretStorageDialog_recoveryKeyButtons {
147-
display: flex;
148-
justify-content: space-between;
149155
align-items: center;
156+
display: flex;
157+
gap: 16px;
158+
}
159+
160+
.mx_CreateSecretStorageDialog_recoveryKeyButtons_copyBtn {
161+
flex-direction: column;
162+
}
163+
164+
.mx_CreateSecretStorageDialog_recoveryKeyCopyButtonText {
165+
overflow-y: hidden;
150166
}
151167

152168
.mx_CreateSecretStorageDialog_recoveryKeyButtons .mx_AccessibleButton {
153-
width: 160px;
154-
padding-left: 0px;
155-
padding-right: 0px;
169+
flex-grow: 1;
156170
white-space: nowrap;
157171
}
158172

Diff for: src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -714,12 +714,13 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
714714
<InlineSpinner />
715715
</div>;
716716
}
717+
717718
return <div>
718719
<p>{ _t(
719720
"Store your Security Key somewhere safe, like a password manager or a safe, " +
720721
"as it’s used to safeguard your encrypted data.",
721722
) }</p>
722-
<div className="mx_CreateSecretStorageDialog_primaryContainer">
723+
<div className="mx_CreateSecretStorageDialog_primaryContainer mx_CreateSecretStorageDialog_recoveryKeyPrimarycontainer">
723724
<div className="mx_CreateSecretStorageDialog_recoveryKeyContainer">
724725
<div className="mx_CreateSecretStorageDialog_recoveryKey">
725726
<code ref={this.recoveryKeyNode}>{ this.recoveryKey.encodedPrivateKey }</code>
@@ -739,7 +740,18 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
739740
onClick={this.onCopyClick}
740741
disabled={this.state.phase === Phase.Storing}
741742
>
742-
{ this.state.copied ? _t("Copied!") : _t("Copy") }
743+
<span
744+
className="mx_CreateSecretStorageDialog_recoveryKeyCopyButtonText"
745+
style={{ height: this.state.copied ? '0' : 'auto' }}
746+
>
747+
{ _t("Copy") }
748+
</span>
749+
<span
750+
className="mx_CreateSecretStorageDialog_recoveryKeyCopyButtonText"
751+
style={{ height: this.state.copied ? 'auto' : '0' }}
752+
>
753+
{ _t("Copied!") }
754+
</span>
743755
</AccessibleButton>
744756
</div>
745757
</div>

0 commit comments

Comments
 (0)