Skip to content

Commit

Permalink
Improve date format dropdown style
Browse files Browse the repository at this point in the history
  • Loading branch information
pakerwreah committed Sep 22, 2024
1 parent 1c7b1f7 commit 9c88e20
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Calendr/Settings/GeneralSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class GeneralSettingsViewController: NSViewController, SettingsUI {

iconStyleDropdown.height(equalTo: showMenuBarIconCheckbox)

dateFormatDropdown.width(lessThanOrEqualTo: view, multiplier: 0.5, priority: .fittingSizeCompression)
dateFormatDropdown.width(equalTo: 150)

if #unavailable(macOS 13.0) {
autoLaunchCheckbox.isHidden = true
Expand All @@ -106,6 +106,8 @@ class GeneralSettingsViewController: NSViewController, SettingsUI {

private lazy var menuBarContent: NSView = {

dateFormatDropdown.isBordered = false

dateFormatTextField.placeholderString = viewModel.dateFormatPlaceholder
dateFormatTextField.refusesFirstResponder = true
dateFormatTextField.focusRingType = .none
Expand All @@ -117,7 +119,6 @@ class GeneralSettingsViewController: NSViewController, SettingsUI {
showMenuBarIconCheckbox,
iconStyleDropdown
])
.with(insets: .init(right: 4))

let dateFormat = NSStackView(
views: [
Expand Down Expand Up @@ -393,6 +394,11 @@ class GeneralSettingsViewController: NSViewController, SettingsUI {
.bind(to: dateFormatTextField.rx.isHidden)
.disposed(by: disposeBag)

viewModel.isDateFormatInputVisible
.map { $0 ? .left : .right }
.bind(to: dateFormatDropdown.rx.alignment)
.disposed(by: disposeBag)

viewModel.isDateFormatInputVisible
.map(true)
.bind(to: view.rx.needsLayout)
Expand Down

0 comments on commit 9c88e20

Please sign in to comment.