Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 1f3df5d

Browse files
author
Alan
authored
Merge pull request #87 from Ultimaker/account-manage-link-optional
Hide account management URL button if no URL is passed
2 parents 5bdb558 + 417743c commit 1f3df5d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/user_account_menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface UserAccountMenuProps {
1919
/** Called when the sign out button is clicked */
2020
onSignOutClickHandler: () => void;
2121
/** URL to the account management page */
22-
manageAccountURL: string;
22+
manageAccountURL?: string;
2323
/** The display name of the user. */
2424
displayName: string
2525
/** An URL for the user profile image. */
@@ -117,10 +117,10 @@ export class UserAccountMenu extends React.Component<UserAccountMenuProps, UserA
117117
</div>
118118

119119
<div className="account-section__buttons">
120-
<Button style="secondary" type="link" linkURL={manageAccountURL} linkToNewTab>
120+
{manageAccountURL && <Button style="secondary" type="link" linkURL={manageAccountURL} linkToNewTab>
121121
{I18n.translate("User account menu button", "Manage account")}
122122
<LinkIcon />
123-
</Button>
123+
</Button>}
124124

125125
<Button style="secondary" onClickHandler={() => { this._setShowMenu(false); onSignOutClickHandler() }}>
126126
{I18n.translate("User account menu button", "Sign out")}

src/stories/menu.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ stories.add('User account menu', withInfo(
6262
)(() =>
6363
<UserAccountMenu
6464
onSignOutClickHandler={action('clicked')}
65-
manageAccountURL="https://account-staging.ultimaker.com"
65+
manageAccountURL={text('Account Management URL', 'https://account.ultimaker.com')}
6666
displayName="Test User"
6767
triggerWidth={text('Trigger width', null)}
6868
triggerHeight={text('Trigger height', null)}
6969
signedOut={boolean('Sign out', false)}
7070
onSignInClickHandler={action('clicked')}
71-
></UserAccountMenu>
71+
/>
7272
));

0 commit comments

Comments
 (0)