This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Muhammad Umer
authored
Mar 17, 2023
1 parent
5a1c318
commit 5e53bda
Showing
18 changed files
with
220 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// ResumeCourseHeaderView.swift | ||
// edX | ||
// | ||
// Created by MuhammadUmer on 12/03/2023. | ||
// Copyright © 2023 edX. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ResumeCourseHeaderView: UIView { | ||
|
||
var tapAction: (() -> ())? | ||
|
||
private lazy var button: UIButton = { | ||
let button = UIButton() | ||
|
||
let arrowImage = Icon.ArrowForward.imageWithFontSize(size: 18).image(with: OEXStyles.shared().primaryBaseColor()) | ||
let imageAttachment = NSTextAttachment() | ||
imageAttachment.image = arrowImage | ||
|
||
if let image = imageAttachment.image { | ||
imageAttachment.bounds = CGRect(x: 0, y: -4, width: image.size.width, height: image.size.height) | ||
} | ||
|
||
let attributedImageString = NSAttributedString(attachment: imageAttachment) | ||
let style = OEXTextStyle(weight: .bold, size: .base, color: OEXStyles.shared().primaryBaseColor()) | ||
|
||
let attributedStrings = [ | ||
style.attributedString(withText: Strings.Dashboard.resumeCourse), | ||
NSAttributedString(string: " "), | ||
attributedImageString, | ||
] | ||
|
||
let attributedTitle = NSAttributedString.joinInNaturalLayout(attributedStrings: attributedStrings) | ||
|
||
button.setAttributedTitle(attributedTitle, for: UIControl.State()) | ||
button.backgroundColor = OEXStyles.shared().neutralWhiteT() | ||
button.layer.borderWidth = 1 | ||
button.layer.borderColor = OEXStyles.shared().neutralXLight().cgColor | ||
button.layer.cornerRadius = 0 | ||
button.layer.masksToBounds = true | ||
button.oex_addAction({ [weak self] _ in | ||
self?.tapAction?() | ||
}, for: .touchUpInside) | ||
return button | ||
}() | ||
|
||
init() { | ||
super.init(frame: .zero) | ||
setupViews() | ||
setConstraints() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func setupViews() { | ||
addSubview(button) | ||
} | ||
|
||
private func setConstraints() { | ||
button.snp.makeConstraints { make in | ||
make.edges.equalTo(self) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.