Skip to content

Commit e18ea55

Browse files
committed
Convert icons to masks
so they're a sensible colour in other themes
1 parent bf45cb0 commit e18ea55

File tree

3 files changed

+44
-17
lines changed

3 files changed

+44
-17
lines changed

res/css/views/dialogs/secretstorage/_CreateSecretStorageDialog.scss

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,25 @@ limitations under the License.
4848
margin-bottom: 1em;
4949
}
5050

51+
.mx_CreateSecretStorageDialog_titleWithIcon::before {
52+
content: '';
53+
display: inline-block;
54+
width: 24px;
55+
height: 24px;
56+
margin-right: 8px;
57+
position: relative;
58+
top: 5px;
59+
background-color: $primary-fg-color;
60+
}
61+
62+
.mx_CreateSecretStorageDialog_secureBackupTitle::before {
63+
mask-image: url('$(res)/img/feather-customised/secure-backup.svg');
64+
}
65+
66+
.mx_CreateSecretStorageDialog_securePhraseTitle::before {
67+
mask-image: url('$(res)/img/feather-customised/secure-phrase.svg');
68+
}
69+
5170
.mx_CreateSecretStorageDialog_centeredTitle, .mx_CreateSecretStorageDialog_centeredBody {
5271
text-align: center;
5372
}
@@ -75,10 +94,21 @@ limitations under the License.
7594
}
7695

7796
.mx_CreateSecretStorageDialog_optionIcon {
97+
display: inline-block;
7898
width: 24px;
99+
height: 24px;
79100
margin-right: 8px;
80101
position: relative;
81102
top: 5px;
103+
background-color: $primary-fg-color;
104+
}
105+
106+
.mx_CreateSecretStorageDialog_optionIcon_securePhrase {
107+
mask-image: url('$(res)/img/feather-customised/secure-phrase.svg');
108+
}
109+
110+
.mx_CreateSecretStorageDialog_optionIcon_secureBackup {
111+
mask-image: url('$(res)/img/feather-customised/secure-backup.svg');
82112
}
83113

84114
.mx_CreateSecretStorageDialog_passPhraseContainer {

src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
446446
checked={this.state.passPhraseKeySelected === CREATE_STORAGE_OPTION_KEY}
447447
>
448448
<div className="mx_CreateSecretStorageDialog_optionTitle">
449-
<img className="mx_CreateSecretStorageDialog_optionIcon"
450-
src={require("../../../../../res/img/feather-customised/secure-backup.svg")}
451-
/>
449+
<span className="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_secureBackup"></span>
452450
{_t("Generate a Security Key")}
453451
</div>
454452
<div>{_t("We’ll generate a Security Key for you to store somewhere safe, like a password manager or a safe.")}</div>
@@ -460,9 +458,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
460458
checked={this.state.passPhraseKeySelected === CREATE_STORAGE_OPTION_PASSPHRASE}
461459
>
462460
<div className="mx_CreateSecretStorageDialog_optionTitle">
463-
<img className="mx_CreateSecretStorageDialog_optionIcon"
464-
src={require("../../../../../res/img/feather-customised/secure-phrase.svg")}
465-
/>
461+
<span className="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_securePhrase"></span>
466462
{_t("Enter a Security Phrase")}
467463
</div>
468464
<div>{_t("Use a secret phrase only you know, and optionally save a Security Key to use for backup.")}</div>
@@ -781,28 +777,25 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
781777
}
782778
}
783779

784-
let headerImage = null;
780+
let titleClass = null;
785781
switch (this.state.phase) {
786782
case PHASE_PASSPHRASE:
787783
case PHASE_PASSPHRASE_CONFIRM:
788-
headerImage = require("../../../../../res/img/feather-customised/secure-phrase.svg");
784+
titleClass = ['mx_CreateSecretStorageDialog_titleWithIcon', 'mx_CreateSecretStorageDialog_securePhraseTitle'];
789785
break;
790786
case PHASE_SHOWKEY:
791-
headerImage = require("../../../../../res/img/feather-customised/secure-backup.svg");
787+
titleClass = ['mx_CreateSecretStorageDialog_titleWithIcon', 'mx_CreateSecretStorageDialog_secureBackupTitle'];
788+
break;
789+
case PHASE_CHOOSE_KEY_PASSPHRASE:
790+
titleClass = 'mx_CreateSecretStorageDialog_centeredTitle';
792791
break;
793-
}
794-
795-
let titleClass = null;
796-
if (this.state.phase === PHASE_CHOOSE_KEY_PASSPHRASE) {
797-
titleClass = 'mx_CreateSecretStorageDialog_centeredTitle';
798792
}
799793

800794
return (
801795
<BaseDialog className='mx_CreateSecretStorageDialog'
802796
onFinished={this.props.onFinished}
803797
title={this._titleForPhase(this.state.phase)}
804798
titleClass={titleClass}
805-
headerImage={headerImage}
806799
hasCancel={this.props.hasCancel && [PHASE_PASSPHRASE].includes(this.state.phase)}
807800
fixedWidth={false}
808801
>

src/components/views/dialogs/BaseDialog.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ export default createReactClass({
7575
// If provided, this is used to add a aria-describedby attribute
7676
contentId: PropTypes.string,
7777

78-
// optional additional class for the title element
79-
titleClass: PropTypes.string,
78+
// optional additional class for the title element (basically anything that can be passed to classnames)
79+
titleClass: PropTypes.oneOfType([
80+
PropTypes.string,
81+
PropTypes.object,
82+
PropTypes.arrayOf(PropTypes.string),
83+
]),
8084
},
8185

8286
getDefaultProps: function() {

0 commit comments

Comments
 (0)