Skip to content

Commit

Permalink
Fix demo prj
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdrone committed Dec 21, 2017
1 parent 57b4d96 commit 43db364
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions samples/Neutrino/src/scenes/components/AppStoreEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct AppStoreEntry {

// The main content view with the entry background image.
private func configureContentView(configuration: UINode<UIImageView>.Configuration) {
let margin: CGFloat = state.expanded ? 0 : MarginPreset.medium.cgFloatValue
let margin: CGFloat = state.expanded ? 0 : 8
let height: CGFloat = state.expanded ? 256 : 128
let radius: CornerRadiusPreset = state.expanded ? .none : .cornerRadius4
configuration.set(\UIImageView.image, props.image)
Expand All @@ -105,7 +105,7 @@ struct AppStoreEntry {
// The container takes all of the parent's width and 80% of the height.
configuration.set(\UIView.yoga.percent.width, 100%)
configuration.set(\UIView.yoga.percent.height, 80%)
configuration.set(\UIView.yoga.padding, MarginPreset.default.cgFloatValue)
configuration.set(\UIView.yoga.padding, 4)
// Lays out the children horizontally.
configuration.set(\UIView.yoga.flexDirection, .row)
}
Expand All @@ -117,7 +117,7 @@ struct AppStoreEntry {
// The container takes all of the parent's width and 20% of the height.
configuration.set(\UIView.yoga.percent.width, 100%)
configuration.set(\UIView.yoga.percent.height, 20%)
configuration.set(\UIView.yoga.padding, MarginPreset.small.cgFloatValue)
configuration.set(\UIView.yoga.padding, 2)
configuration.set(\UIView.yoga.justifyContent, .center)
configuration.set(\UIView.yoga.flexDirection, .row)
configuration.set(\UIView.backgroundColor, Palette.text.color)
Expand All @@ -140,7 +140,7 @@ struct AppStoreEntry {
// The main title.
private func configureLabel(configuration: UINode<UILabel>.Configuration) {
let font: UIFont = state.expanded ? Typography.mediumBold.font : Typography.medium.font
configuration.set(\UILabel.yoga.height, HeightPreset.medium.cgFloatValue)
configuration.set(\UILabel.yoga.height, 32)
configuration.set(\UILabel.font, font)
configuration.set(\UILabel.textColor, Palette.white.color)
}
Expand Down
4 changes: 2 additions & 2 deletions samples/Neutrino/src/scenes/components/Index.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ struct Index {
configuration.set(\UIView.backgroundColor, bkg, animator: animator)
// You can configure your view both using the keyPath accessor (that offer an optional
// animator parameter), or by accessing to the 'renderedView' manually.
configuration.view.yoga.padding = MarginPreset.default.cgFloatValue
configuration.view.yoga.padding = 8
configuration.view.depthPreset = props.isHighlighted ? .depth2 : .none
}

private func configureLabel(configuration: UINode<UILabel>.Configuration) {
let font = props.isHighlighted ? Typography.smallBold.font : Typography.small.font
configuration.view.font = font
configuration.view.textColor = Palette.white.color
configuration.view.yoga.margin = MarginPreset.tiny.cgFloatValue
configuration.view.yoga.margin = 2
}
}
}
7 changes: 3 additions & 4 deletions samples/Neutrino/src/scenes/fragments/Fragments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extension Fragment {
view.textColor = foregroundColor
view.depthPreset = .depth1
view.cornerRadiusPreset = .cornerRadius1
view.yoga.padding = MarginPreset.small.cgFloatValue
view.yoga.padding = 4
view.titleLabel?.font = UIFont.boldSystemFont(ofSize: 13)
return view
}
Expand All @@ -124,10 +124,9 @@ extension Fragment {
/// Used as shape for many of the examples.
static func Polygon() -> UINodeProtocol {
return UINode<UIPolygonView> { config in
let size = HeightPreset.medium.cgFloatValue
config.set(\UIPolygonView.foregroundColor, Palette.white.color)
config.set(\UIPolygonView.yoga.width, size)
config.set(\UIPolygonView.yoga.height, size)
config.set(\UIPolygonView.yoga.width, 44)
config.set(\UIPolygonView.yoga.height, 44)
config.set(\UIPolygonView.yoga.marginRight, 16)
config.set(\UIPolygonView.depthPreset, .depth1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class IndexViewController: UIComponentViewController<Index.Component> {
onCellSelected: presentAppStoreListComponentExample),
Index.CellProps(
title: "Stylesheet-based Counter",
subtitle: "A component that makes extensive use of styles.",
subtitle: "A component that uses styles.",
onCellSelected: presentStylesheetCounterExample),
]
return context.component(Index.Component.self, key: rootKey, props: props)
Expand Down

0 comments on commit 43db364

Please sign in to comment.