Skip to content

Instantly share code, notes, and snippets.

@frosty
Last active June 1, 2018 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frosty/c5ac3b089390d508294a73fc37e4e19f to your computer and use it in GitHub Desktop.
Save frosty/c5ac3b089390d508294a73fc37e4e19f to your computer and use it in GitHub Desktop.
diff --git a/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.h b/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.h
index 75b56bb74d..b9957c09c4 100644
--- a/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.h
+++ b/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.h
@@ -70,6 +70,15 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)applyRestorePageButtonStyle:(UIButton *)button;
+
+#pragma mark - Reader Posts
+
++ (void)applyRestoreSavedPostLabelStyle:(UILabel *)label;
+
++ (void)applyRestoreSavedPostTitleLabelStyle:(UILabel *)label;
+
++ (void)applyRestoreSavedPostButtonStyle:(UIButton *)button;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.m b/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.m
index 625b734548..d2195ede0f 100644
--- a/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.m
+++ b/WordPress/Classes/ViewRelated/Post/WPStyleGuide+Posts.m
@@ -215,7 +215,7 @@ + (void)applySectionHeaderTitleStyle:(UILabel *)label
+ (void)applyRestorePageLabelStyle:(UILabel *)label
{
- [self configureLabelForRegularFontStyle:label];
+ label.font = [WPStyleGuide regularFont];
label.textColor = [self grey];
}
@@ -228,6 +228,34 @@ + (void)applyRestorePageButtonStyle:(UIButton *)button
[button setTitleColor:[WPStyleGuide darkBlue] forState:UIControlStateHighlighted];
}
++ (void)applyRestoreSavedPostLabelStyle:(UILabel *)label
+{
+ [WPStyleGuide configureLabel:label textStyle:UIFontTextStyleCallout];
+ label.textColor = [self greyDarken10];
+}
+
++ (void)applyRestoreSavedPostTitleLabelStyle:(UILabel *)label
+{
+ [WPStyleGuide configureLabel:label
+ textStyle:UIFontTextStyleCallout
+ fontWeight:UIFontWeightSemibold];
+
+ UIFontDescriptor *descriptor = [label.font fontDescriptor];
+ UIFontDescriptorSymbolicTraits traits = [descriptor symbolicTraits];
+ descriptor = [descriptor fontDescriptorWithSymbolicTraits:traits | UIFontDescriptorTraitItalic];
+ label.font = [UIFont fontWithDescriptor:descriptor size:label.font.pointSize];
+ label.textColor = [self greyDarken10];
+}
+
++ (void)applyRestoreSavedPostButtonStyle:(UIButton *)button
+{
+ [WPStyleGuide configureLabel:button.titleLabel
+ textStyle:UIFontTextStyleCallout
+ fontWeight:UIFontWeightSemibold];
+ [button setTitleColor:[WPStyleGuide wordPressBlue] forState:UIControlStateNormal];
+ [button setTitleColor:[WPStyleGuide darkBlue] forState:UIControlStateHighlighted];
+}
+
+ (UIFont *)deviceDependantFontForLabels {
UIFontTextStyle textStyle = [UIDevice isPad] ? UIFontTextStyleSubheadline : UIFontTextStyleCaption1;
return [WPStyleGuide fontForTextStyle:textStyle maximumPointSize:[WPStyleGuide maxFontSize]];
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.swift b/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.swift
index 819b668324..f3971719ec 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.swift
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.swift
@@ -41,9 +41,8 @@ final class ReaderSavedPostUndoCell: UITableViewCell {
private func setupUndoButton() {
undoButton.setTitle(Strings.undo, for: .normal)
- let size = CGSize(width: 20, height: 20)
- let icon = Gridicon.iconOfType(.undo, withSize: size)
- let tintedIcon = icon.imageWithTintColor(WPStyleGuide.lightBlue())
+ let icon = Gridicon.iconOfType(.undo)
+ let tintedIcon = icon.imageWithTintColor(WPStyleGuide.wordPressBlue())
undoButton.setImage(tintedIcon, for: .normal)
}
@@ -52,7 +51,8 @@ final class ReaderSavedPostUndoCell: UITableViewCell {
borderedView.layer.borderColor = WPStyleGuide.readerCardCellBorderColor().cgColor
borderedView.layer.borderWidth = 1.0
- WPStyleGuide.applyRestorePostLabelStyle(removed)
- WPStyleGuide.applyRestorePostLabelStyle(title)
+ WPStyleGuide.applyRestoreSavedPostLabelStyle(removed)
+ WPStyleGuide.applyRestoreSavedPostTitleLabelStyle(title)
+ WPStyleGuide.applyRestoreSavedPostButtonStyle(undoButton)
}
}
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.xib b/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.xib
index de4d9e9a5c..b6400b0391 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.xib
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderSavedPostUndoCell.xib
@@ -6,16 +6,17 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+ <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="ReaderSavedPostUndoCell" customModule="WordPress" customModuleProvider="target">
+ <tableViewCell contentMode="scaleToFill" layoutMarginsFollowReadableWidth="YES" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="ReaderSavedPostUndoCell" customModule="WordPress" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" layoutMarginsFollowReadableWidth="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
@@ -23,27 +24,27 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
- <stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0qS-wL-AiS">
+ <stackView opaque="NO" contentMode="scaleToFill" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="0qS-wL-AiS">
<rect key="frame" x="16" y="6" width="288" height="30"/>
<subviews>
- <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="edF-mf-PsH">
- <rect key="frame" x="0.0" y="0.0" width="242" height="30"/>
+ <stackView opaque="NO" contentMode="scaleToFill" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="edF-mf-PsH">
+ <rect key="frame" x="0.0" y="0.0" width="226" height="30"/>
<subviews>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="750" verticalHuggingPriority="251" text="Removed" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qPM-It-aeV">
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="750" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="Removed" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qPM-It-aeV">
<rect key="frame" x="0.0" y="0.0" width="71.5" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lnR-4i-vdi">
- <rect key="frame" x="79.5" y="0.0" width="162.5" height="30"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lnR-4i-vdi">
+ <rect key="frame" x="77.5" y="0.0" width="148.5" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
- <button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jmj-W8-Yz3">
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jmj-W8-Yz3">
<rect key="frame" x="242" y="0.0" width="46" height="30"/>
<state key="normal" title="Button"/>
<connections>
@@ -54,10 +55,10 @@
</stackView>
</subviews>
<constraints>
- <constraint firstItem="0qS-wL-AiS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="FCo-M3-vdJ"/>
+ <constraint firstItem="0qS-wL-AiS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="FCo-M3-vdJ"/>
<constraint firstAttribute="trailing" secondItem="TBy-h6-gyK" secondAttribute="trailing" id="HV5-h3-5B3"/>
<constraint firstAttribute="bottom" secondItem="TBy-h6-gyK" secondAttribute="bottom" constant="-0.5" id="UDU-ic-hD6"/>
- <constraint firstAttribute="trailing" secondItem="0qS-wL-AiS" secondAttribute="trailing" constant="16" id="dU4-cX-eF9"/>
+ <constraint firstAttribute="trailingMargin" secondItem="0qS-wL-AiS" secondAttribute="trailing" id="dU4-cX-eF9"/>
<constraint firstItem="TBy-h6-gyK" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="eGO-Jj-XbX"/>
<constraint firstItem="TBy-h6-gyK" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="pGx-RV-Mba"/>
<constraint firstItem="0qS-wL-AiS" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="rhX-kB-f68"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment