Skip to content

Commit

Permalink
Merge pull request #1194 from Automattic/charlie/magic-link-ui
Browse files Browse the repository at this point in the history
Magic Links: UI Updates Mk1
  • Loading branch information
charliescheer authored Jul 24, 2024
2 parents cfbf7c1 + a670f8e commit 7294414
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 83 deletions.
37 changes: 21 additions & 16 deletions Simplenote/AuthViewController+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ extension AuthViewController {
// Secondary Action
secondaryActionButton.contentTintColor = .simplenoteBrandColor

// Toggle Signup: Tip
switchTipField.textColor = .simplenoteTertiaryTextColor

// Toggle Signup: Action
switchActionButton.contentTintColor = .simplenoteBrandColor

// WordPress SSO
wordPressSSOButton.image = NSImage(named: .wordPressLogo)?.tinted(with: .simplenoteBrandColor)
wordPressSSOButton.title = Localization.dotcomSSOAction
wordPressSSOButton.contentTintColor = .simplenoteTertiaryTextColor
wordPressSSOButton.contentTintColor = .white
wordPressSSOContainerView.wantsLayer = true
wordPressSSOContainerView.layer?.backgroundColor = NSColor.simplenoteWPBlue50Color.cgColor
wordPressSSOContainerView.layer?.cornerRadius = 5

setupActionsSeparatorView()
}

private func setupActionsSeparatorView() {
leadingSeparatorView.wantsLayer = true
leadingSeparatorView.layer?.backgroundColor = NSColor.lightGray.cgColor
trailingSeparatorView.wantsLayer = true
trailingSeparatorView.layer?.backgroundColor = NSColor.lightGray.cgColor

separatorLabel.textColor = .lightGray
}
}

Expand Down Expand Up @@ -67,8 +74,6 @@ extension AuthViewController {
func refreshButtonTitles() {
actionButton.title = mode.primaryActionText
secondaryActionButton.title = mode.secondaryActionText?.uppercased() ?? ""
switchTipField.stringValue = mode.switchActionTip.uppercased()
switchActionButton.title = mode.switchActionText.uppercased()
}

/// Makes sure unused components (in the current mode) are effectively disabled
Expand Down Expand Up @@ -102,7 +107,7 @@ extension AuthViewController {
secondaryActionButton.alphaValue = mode.secondaryActionFieldAlpha
wordPressSSOButton.alphaValue = mode.wordPressSSOFieldAlpha

switchAuthenticationView.isHidden = !mode.isSwitchVisible
actionsSeparatorView.isHidden = !mode.showActionSeparator
}

/// Animates Visible / Invisible components, based on the specified state
Expand Down Expand Up @@ -167,11 +172,6 @@ extension AuthViewController {
performSelector(onMainThread: secondaryActionSelector, with: nil, waitUntilDone: false)
}

@IBAction
func switchAuthenticationMode(_ sender: Any) {
containingNavigationController?.push(nextViewController())
}

private func nextViewController() -> AuthViewController {
let nextMode = mode.nextMode()

Expand All @@ -181,6 +181,11 @@ extension AuthViewController {

return nextVC
}

@objc
func pushEmailLoginView() {
containingNavigationController?.push(nextViewController())
}
}


Expand Down
7 changes: 4 additions & 3 deletions Simplenote/AuthViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
@property (nonatomic, strong) IBOutlet NSButton *actionButton;
@property (nonatomic, strong) IBOutlet NSProgressIndicator *actionProgress;
@property (nonatomic, strong) IBOutlet NSButton *secondaryActionButton;
@property (nonatomic, strong) IBOutlet NSTextField *switchTipField;
@property (nonatomic, strong) IBOutlet NSButton *switchActionButton;
@property (nonatomic, strong) IBOutlet NSView *wordPressSSOContainerView;
@property (nonatomic, strong) IBOutlet NSButton *wordPressSSOButton;
@property (weak) IBOutlet NSView *switchAuthenticationView;
@property (weak) IBOutlet NSView *actionsSeparatorView;
@property (weak) IBOutlet NSView *leadingSeparatorView;
@property (weak) IBOutlet NSTextField *separatorLabel;
@property (weak) IBOutlet NSView *trailingSeparatorView;

@property (nonatomic, strong) IBOutlet NSLayoutConstraint *passwordFieldHeightConstraint;
@property (nonatomic, strong) IBOutlet NSLayoutConstraint *secondaryActionHeightConstraint;
Expand Down
1 change: 0 additions & 1 deletion Simplenote/AuthViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ - (void)setInterfaceEnabled:(BOOL)enabled {
[self.passwordField setEnabled:enabled];
[self.actionButton setEnabled:enabled];
[self.secondaryActionButton setEnabled:enabled];
[self.switchActionButton setEnabled:enabled];
[self.wordPressSSOButton setEnabled:enabled];
}

Expand Down
Loading

0 comments on commit 7294414

Please sign in to comment.