Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Course info: info tab UI #406

Merged
merged 52 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
20e25e5
Add image resources
ivan-magda Nov 2, 2018
3f45191
Add course info localizable strings
ivan-magda Nov 2, 2018
66a0614
Create course info text block view
ivan-magda Nov 2, 2018
6544a3a
Create course info instructors block view
ivan-magda Nov 2, 2018
425ae2b
Layout instructors
ivan-magda Nov 5, 2018
ab8351f
Better spacing
ivan-magda Nov 6, 2018
dedfde7
Update instructors description text color
ivan-magda Nov 6, 2018
b118c4c
Add intro tmp imageView
ivan-magda Nov 6, 2018
3c875cb
Round instructor avatar
ivan-magda Nov 6, 2018
f86fad4
Fix with spacing
ivan-magda Nov 6, 2018
4a0a952
Refactor rename course info type
ivan-magda Nov 6, 2018
d0d6102
Create CourseInfoSkeletonView file
ivan-magda Nov 7, 2018
8251add
Create new group CourseInfoTab
ivan-magda Nov 9, 2018
0fc805d
Create view and view model groups
ivan-magda Nov 9, 2018
7169967
Load avatar image
ivan-magda Nov 9, 2018
cf8ab11
Remove image literal
ivan-magda Nov 9, 2018
87151af
Use constructors with no params
ivan-magda Nov 9, 2018
4ad7299
Create CourseInfoTabInfoViewDelegate
ivan-magda Nov 9, 2018
2e40a55
Change type of intro URL
ivan-magda Nov 9, 2018
d136489
Refactor extract configure with view model method
ivan-magda Nov 9, 2018
9feace0
Create block views builder
ivan-magda Nov 9, 2018
be4fcd1
Make intro video view
ivan-magda Nov 9, 2018
2e66c40
Refactor rename CourseInfoSkeletonView -> CourseInfoTabInfoSkeletonView
ivan-magda Nov 9, 2018
a715c64
Remove unnecessary content insets
ivan-magda Nov 9, 2018
0852b65
Tmp for skeleton
ivan-magda Nov 9, 2018
5dc5994
Add skeletons
ivan-magda Nov 9, 2018
cfd588a
Rearrange groups
ivan-magda Nov 9, 2018
8860d06
Format code
ivan-magda Nov 9, 2018
f92cb49
Create view controller
ivan-magda Nov 9, 2018
167846d
Fix skeleton constraints
ivan-magda Nov 10, 2018
cc4102a
Simplify info block skeleton constraints
ivan-magda Nov 11, 2018
a20e3fb
Fix course info block skeleton view setup
ivan-magda Nov 13, 2018
0390044
Refactor rename imageView -> iconImageView
ivan-magda Nov 13, 2018
5d79cd5
Fix make concreate course info tab view lazy
ivan-magda Nov 13, 2018
2ca6848
Use configure(viewModel:) style
ivan-magda Nov 13, 2018
30018f4
Remove viewModel from view's constructors
ivan-magda Nov 13, 2018
618df9c
Refactor rename imageView -> previewImageView
ivan-magda Nov 13, 2018
d94ce35
Use main dark color
ivan-magda Nov 13, 2018
2b7b3a7
Remove JoinButton appearance struct
ivan-magda Nov 13, 2018
4193d1e
Refactor rename CourseInfoTabInfoBlockType -> CourseInfoTabInfoBlock
ivan-magda Nov 13, 2018
26cfd47
Use inner elements and blocks insets
ivan-magda Nov 13, 2018
adfec40
Update source files headers
ivan-magda Nov 14, 2018
f32ddd9
Use stepik green color
ivan-magda Nov 14, 2018
71fa449
Apply fixes for blocks
ivan-magda Nov 14, 2018
e99b013
Fixes
ivan-magda Nov 14, 2018
b122586
Remove private(set) for lazy property
ivan-magda Nov 15, 2018
8421563
Refactor rename
ivan-magda Nov 15, 2018
0ca6f22
Refactor rename
ivan-magda Nov 15, 2018
2afb499
Refactor rename
ivan-magda Nov 15, 2018
ce93fd1
Add author view with function
ivan-magda Nov 15, 2018
24760f7
Use CourseCoverImageView as instructors avatar image view
ivan-magda Nov 27, 2018
96547e2
Open appearance
ivan-magda Nov 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions Stepic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions Stepic/CourseInfoTabInfoBlockSkeletonView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// CourseInfoTabInfoBlockSkeletonView.swift
// stepik-ios
//
// Created by Ivan Magda on 11/9/18.
ivan-magda marked this conversation as resolved.
Show resolved Hide resolved
// Copyright (c) 2018 Alex Karpov. All rights reserved.
//

import UIKit
import SnapKit

extension CourseInfoTabInfoBlockSkeletonView {
struct Appearance {
let imageViewSize = CGSize(width: 12, height: 12)
let imageViewCornerRadius: CGFloat = 1

let titleLabelHeight: CGFloat = 17
let titleLabelLeadingOffset: CGFloat = 27
var titleLabelCornerRadius: CGFloat = 1
}
}

final class CourseInfoTabInfoBlockSkeletonView: UIView {
let appearance: Appearance

private lazy var imageViewSkeleton: UIView = {
let view = UIView()
view.clipsToBounds = true
view.layer.cornerRadius = self.appearance.imageViewCornerRadius

return view
}()

private lazy var titleLabelSkeleton: UIView = {
let view = UIView()
view.clipsToBounds = true
view.layer.cornerRadius = self.appearance.titleLabelCornerRadius

return view
}()

init(frame: CGRect = .zero, appearance: Appearance = Appearance()) {
self.appearance = appearance
super.init(frame: frame)

self.setupView()
self.addSubviews()
self.makeConstraints()
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

extension CourseInfoTabInfoBlockSkeletonView: ProgrammaticallyInitializableViewProtocol {
func setupView() {
self.backgroundColor = .clear
}

func addSubviews() {
self.addSubview(self.imageViewSkeleton)
self.addSubview(self.titleLabelSkeleton)
}

func makeConstraints() {
self.imageViewSkeleton.translatesAutoresizingMaskIntoConstraints = false
self.imageViewSkeleton.snp.makeConstraints { make in
make.leading.equalToSuperview()
make.size.equalTo(self.appearance.imageViewSize)
make.centerY.equalTo(self.titleLabelSkeleton.snp.centerY)
}

self.titleLabelSkeleton.translatesAutoresizingMaskIntoConstraints = false
self.titleLabelSkeleton.snp.makeConstraints { make in
make.top.trailing.bottom.equalToSuperview()
make.height.equalTo(self.appearance.titleLabelHeight)
make.leading
.equalToSuperview()
.offset(self.appearance.titleLabelLeadingOffset)
}
}
}
103 changes: 103 additions & 0 deletions Stepic/CourseInfoTabInfoInstructorSkeletonView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
//
// CourseInfoTabInfoInstructorSkeletonView.swift
// stepik-ios
//
// Created by Ivan Magda on 11/9/18.
// Copyright (c) 2018 Alex Karpov. All rights reserved.
//

import UIKit
import SnapKit

extension CourseInfoTabInfoInstructorSkeletonView {
struct Appearance {
var labelsCornerRadius: CGFloat = 2

let imageViewCornerRadius: CGFloat = 5
let imageViewSize = CGSize(width: 30, height: 30)

let titleLabelHeight: CGFloat = 17
let titleLabelOffsetLeading: CGFloat = 17

let descriptionLabelOffsetTop: CGFloat = 20
let descriptionLabelHeight: CGFloat = 80
}
}

final class CourseInfoTabInfoInstructorSkeletonView: UIView {
private let appearance: Appearance

private lazy var imageViewSkeleton: UIView = {
let view = UIView()
view.clipsToBounds = true
view.layer.cornerRadius = self.appearance.imageViewCornerRadius
return view
}()

private lazy var titleLabelSkeleton: UIView = {
let view = UIView()
view.clipsToBounds = true
view.layer.cornerRadius = self.appearance.labelsCornerRadius
return view
}()

private lazy var descriptionLabelSkeleton: UIView = {
let view = UIView()
view.clipsToBounds = true
view.layer.cornerRadius = self.appearance.labelsCornerRadius
return view
}()

init(frame: CGRect = .zero, appearance: Appearance = Appearance()) {
self.appearance = appearance
super.init(frame: frame)

self.setupView()
self.addSubviews()
self.makeConstraints()
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

extension CourseInfoTabInfoInstructorSkeletonView: ProgrammaticallyInitializableViewProtocol {
func setupView() {
self.backgroundColor = .clear
}

func addSubviews() {
self.addSubview(self.imageViewSkeleton)
self.addSubview(self.titleLabelSkeleton)
self.addSubview(self.descriptionLabelSkeleton)
}

func makeConstraints() {
self.imageViewSkeleton.translatesAutoresizingMaskIntoConstraints = false
self.imageViewSkeleton.snp.makeConstraints { make in
make.size.equalTo(self.appearance.imageViewSize)
make.leading.top.equalToSuperview()
}

self.titleLabelSkeleton.translatesAutoresizingMaskIntoConstraints = false
self.titleLabelSkeleton.snp.makeConstraints { make in
make.centerY.equalTo(self.imageViewSkeleton.snp.centerY)
make.trailing.equalToSuperview()
make.height.equalTo(self.appearance.titleLabelHeight)
make.leading
.equalTo(self.imageViewSkeleton.snp.trailing)
.offset(self.appearance.titleLabelOffsetLeading)
}

self.descriptionLabelSkeleton.translatesAutoresizingMaskIntoConstraints = false
self.descriptionLabelSkeleton.snp.makeConstraints { make in
make.leading.equalTo(self.imageViewSkeleton.snp.leading)
make.trailing.bottom.equalToSuperview()
make.height.equalTo(self.appearance.descriptionLabelHeight)
make.top
.equalTo(self.imageViewSkeleton.snp.bottom)
.offset(self.appearance.descriptionLabelOffsetTop)
}
}
}
Loading