Skip to content

Commit

Permalink
Updates heading text to Sentence case. (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne authored Aug 29, 2024
1 parent 06fffce commit 620b04b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 39 deletions.
8 changes: 4 additions & 4 deletions settings/src/components/account-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function AccountStatus() {
<SettingStatusCard
screen="email"
status={ emailStatus }
headerText="Account Email"
headerText="Account email"
bodyText={
pendingEmail
? `Your account email is pending a change to ${ pendingEmail }.`
Expand All @@ -59,7 +59,7 @@ export default function AccountStatus() {
<SettingStatusCard
screen="webauthn"
status={ hasPrimaryProvider && ! webAuthnEnabled ? 'info' : webAuthnEnabled }
headerText="Two-Factor Security Key"
headerText="Two-factor security key"
bodyText={
webAuthnEnabled
? 'You have two-factor authentication enabled using security keys.'
Expand All @@ -71,7 +71,7 @@ export default function AccountStatus() {
<SettingStatusCard
screen="totp"
status={ hasPrimaryProvider && ! totpEnabled ? 'info' : totpEnabled }
headerText="Two-Factor App"
headerText="Two-factor app"
bodyText={
totpEnabled
? 'You have two-factor authentication enabled using an app.'
Expand All @@ -85,7 +85,7 @@ export default function AccountStatus() {
status={
! hasPrimaryProvider && ! backupCodesEnabled ? 'pending' : backupCodesEnabled
}
headerText="Two-Factor Backup Codes"
headerText="Two-factor backup codes"
bodyText={ backupBodyText }
disabled={ ! hasPrimaryProvider }
/>
Expand Down
9 changes: 1 addition & 8 deletions settings/src/components/screen-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ const ScreenNavigation = ( { screen, children, title = '', canNavigate = true }
/>
) }

<h3>
{ title.length
? title
: screen
.replace( '-', ' ' )
.replace( 'totp', 'Two-Factor Authentication' )
.replace( 'webauthn', 'Two-Factor Security Key' ) }
</h3>
<h3>{ title }</h3>
</CardHeader>
<CardBody className={ 'wporg-2fa__' + screen }>{ children }</CardBody>
</Card>
Expand Down
1 change: 0 additions & 1 deletion settings/src/components/screen-navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
h3 {
font-weight: 600;
margin: unset;
text-transform: capitalize;
}

}
68 changes: 42 additions & 26 deletions settings/src/components/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,53 @@ export default function Settings() {

// The index is the URL slug and the value is the React component.
const components = {
home: <AccountStatus />,
email: <EmailAddress />,
password: <Password />,
totp: (
<TOTP
onSuccess={ () => {
if ( ! backupCodesEnabled ) {
navigateToScreen( 'backup-codes' );
} else {
navigateToScreen( 'home' );
}
} }
/>
),
webauthn: (
<WebAuthn
onKeyAdd={ () => {
if ( ! backupCodesEnabled ) {
navigateToScreen( 'backup-codes' );
}
} }
/>
),
'backup-codes': <BackupCodes onSuccess={ () => navigateToScreen( 'home' ) } />,
email: {
title: 'Account email',
component: <EmailAddress />,
},
password: {
title: 'Password',
component: <Password />,
},
totp: {
title: 'Two-factor authentication',
component: (
<TOTP
onSuccess={ () => {
if ( ! backupCodesEnabled ) {
navigateToScreen( 'backup-codes' );
} else {
navigateToScreen( 'home' );
}
} }
/>
),
},
'backup-codes': {
title: 'Backup codes',
component: <BackupCodes onSuccess={ () => navigateToScreen( 'home' ) } />,
},
webauthn: {
title: 'Two-factor security key',
component: (
<WebAuthn
onKeyAdd={ () => {
if ( ! backupCodesEnabled ) {
navigateToScreen( 'backup-codes' );
}
} }
/>
),
},
};

const currentScreenComponent =
'home' === screen ? (
components[ screen ]
<AccountStatus />
) : (
<ScreenNavigation screen={ screen }>{ components[ screen ] }</ScreenNavigation>
<ScreenNavigation screen={ screen } title={ components[ screen ].title }>
{ components[ screen ].component }
</ScreenNavigation>
);

return currentScreenComponent;
Expand Down

0 comments on commit 620b04b

Please sign in to comment.