Skip to content

Commit ff71715

Browse files
committed
Refactor buttons
# Conflicts: # Mixin.xcodeproj/project.pbxproj # Mixin/Extension/AttributedString+Convenience.swift
1 parent 5060cfd commit ff71715

2 files changed

Lines changed: 37 additions & 16 deletions

File tree

Mixin/UserInterface/Controllers/Login/OnboardingView.xib

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24765" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_12" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24504"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24743"/>
77
<capability name="Named colors" minToolsVersion="9.0"/>
88
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -47,24 +47,36 @@
4747
<color key="currentPageIndicatorTintColor" name="theme"/>
4848
</pageControl>
4949
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="fRK-Pd-5iu">
50-
<rect key="frame" x="36" y="624" width="321" height="114"/>
50+
<rect key="frame" x="36" y="635.33333333333337" width="321" height="102.66666666666663"/>
5151
<subviews>
52-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DL9-pg-F8H" customClass="StyledButton" customModule="Mixin" customModuleProvider="target">
53-
<rect key="frame" x="0.0" y="0.0" width="321" height="49"/>
52+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DL9-pg-F8H">
53+
<rect key="frame" x="0.0" y="0.0" width="321" height="44.333333333333336"/>
5454
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
5555
<inset key="contentEdgeInsets" minX="0.0" minY="14" maxX="0.0" maxY="15"/>
5656
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
5757
<state key="normal" title="Create account"/>
58+
<buttonConfiguration key="configuration" style="filled" title="Create account" cornerStyle="capsule">
59+
<fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="16"/>
60+
<directionalEdgeInsets key="contentInsets" top="12" leading="0.0" bottom="13" trailing="0.0"/>
61+
<color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
62+
<color key="baseBackgroundColor" name="theme"/>
63+
</buttonConfiguration>
5864
<connections>
5965
<action selector="signUp:" destination="-1" eventType="touchUpInside" id="wV1-Hw-QGI"/>
6066
</connections>
6167
</button>
62-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GyF-Ya-ePo" customClass="StyledButton" customModule="Mixin" customModuleProvider="target">
63-
<rect key="frame" x="0.0" y="65" width="321" height="49"/>
68+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GyF-Ya-ePo">
69+
<rect key="frame" x="0.0" y="60.333333333333258" width="321" height="42.333333333333343"/>
6470
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
6571
<inset key="contentEdgeInsets" minX="0.0" minY="14" maxX="0.0" maxY="15"/>
6672
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
6773
<state key="normal" title="I already have an account"/>
74+
<buttonConfiguration key="configuration" style="filled" title="I already have an account" cornerStyle="capsule">
75+
<fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="16"/>
76+
<directionalEdgeInsets key="contentInsets" top="12" leading="0.0" bottom="11" trailing="0.0"/>
77+
<color key="baseForegroundColor" name="theme"/>
78+
<color key="baseBackgroundColor" name="background_quaternary"/>
79+
</buttonConfiguration>
6880
<connections>
6981
<action selector="signIn:" destination="-1" eventType="touchUpInside" id="SXh-69-9nb"/>
7082
</connections>
@@ -103,11 +115,14 @@
103115
<namedColor name="background">
104116
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
105117
</namedColor>
118+
<namedColor name="background_quaternary">
119+
<color red="0.96470588235294119" green="0.96862745098039216" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
120+
</namedColor>
106121
<namedColor name="button_background_disabled">
107122
<color red="0.82745098039215681" green="0.83137254901960789" blue="0.83529411764705885" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
108123
</namedColor>
109124
<namedColor name="text_tertiary">
110-
<color red="0.53333333333333333" green="0.53333333333333333" blue="0.53333333333333333" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
125+
<color red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
111126
</namedColor>
112127
<namedColor name="theme">
113128
<color red="0.23921568627450981" green="0.45882352941176469" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>

Mixin/UserInterface/Controllers/Login/OnboardingViewController.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ final class OnboardingViewController: UIViewController {
55

66
@IBOutlet weak var collectionView: UICollectionView!
77
@IBOutlet weak var pageControl: UIPageControl!
8-
@IBOutlet weak var signUpButton: StyledButton!
9-
@IBOutlet weak var signInButton: StyledButton!
8+
@IBOutlet weak var signUpButton: UIButton!
9+
@IBOutlet weak var signInButton: UIButton!
1010
@IBOutlet weak var versionLabel: UILabel!
1111

1212
@IBOutlet weak var actionsBottomConstraint: NSLayoutConstraint!
@@ -96,12 +96,18 @@ final class OnboardingViewController: UIViewController {
9696
case .long, .extraLong:
9797
actionsBottomConstraint.constant = 38
9898
}
99-
signUpButton.setTitle(R.string.localizable.create_account(), for: .normal)
100-
signUpButton.titleLabel?.setFont(scaledFor: .systemFont(ofSize: 16, weight: .medium), adjustForContentSize: true)
101-
signUpButton.style = .filled
102-
signInButton.setTitle(R.string.localizable.landing_have_account(), for: .normal)
103-
signInButton.titleLabel?.setFont(scaledFor: .systemFont(ofSize: 16, weight: .medium), adjustForContentSize: true)
104-
signInButton.style = .tinted
99+
signUpButton.configuration?.attributedTitle = AttributedString(
100+
string: R.string.localizable.create_account(),
101+
scalingByFontSize: 16,
102+
weight: .medium
103+
)
104+
signUpButton.titleLabel?.adjustsFontForContentSizeCategory = true
105+
signInButton.configuration?.attributedTitle = AttributedString(
106+
string: R.string.localizable.landing_have_account(),
107+
scalingByFontSize: 16,
108+
weight: .medium
109+
)
110+
signInButton.titleLabel?.adjustsFontForContentSizeCategory = true
105111
versionLabel.text = R.string.localizable.current_version(Bundle.main.fullVersion)
106112

107113
collectionView.dataSource = self

0 commit comments

Comments
 (0)