Skip to content

Commit 5351dbc

Browse files
committed
feat: add bottom navigation bar with home button and color theme system
1 parent bb51009 commit 5351dbc

File tree

4 files changed

+111
-2
lines changed

4 files changed

+111
-2
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import UIKit
2+
3+
class BottomNavigationBar: UIView {
4+
// Home button
5+
private let homeButton = UIButton(type: .system)
6+
7+
// Callback for when home button is tapped
8+
var onHomeTapped: (() -> Void)?
9+
10+
override init(frame: CGRect) {
11+
super.init(frame: frame)
12+
setupView()
13+
}
14+
15+
required init?(coder: NSCoder) {
16+
super.init(coder: coder)
17+
setupView()
18+
}
19+
20+
private func setupView() {
21+
// Set background color to primary color
22+
backgroundColor = AppColors.primary
23+
24+
// Configure home button
25+
homeButton.setTitle("Home", for: .normal)
26+
homeButton.setTitleColor(AppColors.textOnPrimary, for: .normal)
27+
homeButton.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
28+
homeButton.addTarget(self, action: #selector(homeButtonTapped), for: .touchUpInside)
29+
30+
// Add home button to view
31+
homeButton.translatesAutoresizingMaskIntoConstraints = false
32+
addSubview(homeButton)
33+
34+
// Center the home button
35+
NSLayoutConstraint.activate([
36+
homeButton.centerXAnchor.constraint(equalTo: centerXAnchor),
37+
homeButton.centerYAnchor.constraint(equalTo: centerYAnchor),
38+
homeButton.heightAnchor.constraint(equalToConstant: 44)
39+
])
40+
}
41+
42+
@objc private func homeButtonTapped() {
43+
onHomeTapped?()
44+
}
45+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import UIKit
2+
3+
struct AppColors {
4+
// Base colors from theme.css
5+
static let primary = UIColor(hex: 0xE02337) // Profullstack, Inc. red
6+
static let primaryLight = UIColor(hex: 0xE54D5D) // Lighter red
7+
static let primaryDark = UIColor(hex: 0xC01D2F) // Darker red
8+
static let secondary = UIColor(hex: 0xFC7E3E) // Accent orange
9+
static let secondaryLight = UIColor(hex: 0xFD9C6A) // Lighter orange
10+
static let secondaryDark = UIColor(hex: 0xE66A2C) // Darker orange
11+
static let accent = UIColor(hex: 0xBA18AA) // Accent magenta
12+
13+
// Neutral colors
14+
static let background = UIColor.white // White background
15+
static let surface = UIColor(hex: 0xF9FAFB) // Light gray surface
16+
static let surfaceVariant = UIColor(hex: 0xF3F4F6) // Slightly darker surface
17+
static let border = UIColor(hex: 0xE5E7EB) // Light border
18+
static let divider = UIColor(hex: 0xD1D5DB) // Divider color
19+
20+
// Text colors
21+
static let textPrimary = UIColor(hex: 0x111827) // Near black for primary text
22+
static let textSecondary = UIColor(hex: 0x4B5563) // Dark gray for secondary text
23+
static let textTertiary = UIColor(hex: 0x6B7280) // Medium gray for tertiary text
24+
static let textDisabled = UIColor(hex: 0x9CA3AF) // Light gray for disabled text
25+
static let textOnPrimary = UIColor.white // White text on primary color
26+
static let textOnSecondary = UIColor.white // White text on secondary color
27+
}
28+
29+
// Extension to create UIColor from hex value
30+
extension UIColor {
31+
convenience init(hex: UInt32, alpha: CGFloat = 1.0) {
32+
let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0
33+
let green = CGFloat((hex & 0x00FF00) >> 8) / 255.0
34+
let blue = CGFloat(hex & 0x0000FF) / 255.0
35+
36+
self.init(red: red, green: green, blue: blue, alpha: alpha)
37+
}
38+
}

ios/PDFConverter/PDFConverter/Config.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ struct Config {
2727
}
2828

2929
// Fallback to default URL
30-
return "https://profullstack.com/pdf"
30+
return "https://convert2doc.com"
3131
}()
3232
}

ios/PDFConverter/PDFConverter/ViewController.swift

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import WebKit
44
class ViewController: UIViewController, WKNavigationDelegate {
55
private var webView: WKWebView!
66
private var progressView: UIProgressView!
7+
private var bottomNavigationBar: BottomNavigationBar!
78
private var observation: NSKeyValueObservation?
89

910
override func viewDidLoad() {
@@ -12,6 +13,7 @@ class ViewController: UIViewController, WKNavigationDelegate {
1213
setupWebView()
1314
setupProgressView()
1415
setupNavigationBar()
16+
setupBottomNavigationBar()
1517
loadWebsite()
1618
}
1719

@@ -25,7 +27,12 @@ class ViewController: UIViewController, WKNavigationDelegate {
2527
preferences.allowsContentJavaScript = true
2628
configuration.defaultWebpagePreferences = preferences
2729

28-
webView = WKWebView(frame: view.bounds, configuration: configuration)
30+
// Create webView with adjusted frame to account for bottom navigation bar
31+
let bottomBarHeight: CGFloat = 56
32+
var webViewFrame = view.bounds
33+
webViewFrame.size.height -= bottomBarHeight
34+
35+
webView = WKWebView(frame: webViewFrame, configuration: configuration)
2936
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
3037
webView.navigationDelegate = self
3138
view.addSubview(webView)
@@ -61,6 +68,25 @@ class ViewController: UIViewController, WKNavigationDelegate {
6168
)
6269
}
6370

71+
private func setupBottomNavigationBar() {
72+
let bottomBarHeight: CGFloat = 56
73+
let bottomBarFrame = CGRect(
74+
x: 0,
75+
y: view.bounds.height - bottomBarHeight,
76+
width: view.bounds.width,
77+
height: bottomBarHeight
78+
)
79+
80+
bottomNavigationBar = BottomNavigationBar(frame: bottomBarFrame)
81+
bottomNavigationBar.autoresizingMask = [.flexibleWidth, .flexibleTopMargin]
82+
view.addSubview(bottomNavigationBar)
83+
84+
// Set up home button action
85+
bottomNavigationBar.onHomeTapped = { [weak self] in
86+
self?.loadWebsite()
87+
}
88+
}
89+
6490
private func loadWebsite() {
6591
// Load URL from Config which reads from .env file
6692
if let url = URL(string: Config.apiBaseURL) {

0 commit comments

Comments
 (0)