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

fix: fix UI design #142

Merged
merged 4 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions Box42.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
64D699FE2AA5F69900EEF7BC /* BookmarkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64D699FD2AA5F69900EEF7BC /* BookmarkModel.swift */; };
64D69A012AA5F97B00EEF7BC /* BookmarkViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64D699F72AA5F5C100EEF7BC /* BookmarkViewModel.swift */; };
7E9B46922AA5C564009EB900 /* BookmarkEditorTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E9B46912AA5C564009EB900 /* BookmarkEditorTableView.swift */; };
D67E67992AA83531005A61CF /* prefsHelper.app in Resources */ = {isa = PBXBuildFile; fileRef = D67E67982AA83531005A61CF /* prefsHelper.app */; };
DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */; };
DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */; };
DE018BDD2A509AEB00FF0AA3 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BDC2A509AEB00FF0AA3 /* EventMonitor.swift */; };
Expand Down Expand Up @@ -148,6 +149,7 @@
64D699F72AA5F5C100EEF7BC /* BookmarkViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkViewModel.swift; sourceTree = "<group>"; };
64D699FD2AA5F69900EEF7BC /* BookmarkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkModel.swift; sourceTree = "<group>"; };
7E9B46912AA5C564009EB900 /* BookmarkEditorTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkEditorTableView.swift; sourceTree = "<group>"; };
D67E67982AA83531005A61CF /* prefsHelper.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; name = prefsHelper.app; path = ../../Downloads/prefsHelper.app; sourceTree = "<group>"; };
DE018BAF2A5099F900FF0AA3 /* Box42.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Box42.app; sourceTree = BUILT_PRODUCTS_DIR; };
DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
DE018BB72A5099F900FF0AA3 /* Box42.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Box42.xcdatamodel; sourceTree = "<group>"; };
Expand Down Expand Up @@ -326,6 +328,7 @@
DE018BA62A5099F900FF0AA3 = {
isa = PBXGroup;
children = (
D67E67982AA83531005A61CF /* prefsHelper.app */,
DE018BB12A5099F900FF0AA3 /* Box42 */,
DE018BB02A5099F900FF0AA3 /* Products */,
DE17AF722A834A1600325BF4 /* Frameworks */,
Expand Down Expand Up @@ -944,6 +947,7 @@
DE7F9D462A9B7A4700F8ACAE /* QuickSlotButtonViewItem.xib in Resources */,
DEB862D92A852C4500278FCD /* brewInGoinfre.sh in Resources */,
DE62BE5A2A9BA31700D97E06 /* QuickSlotButtonCollectionViewController.xib in Resources */,
D67E67992AA83531005A61CF /* prefsHelper.app in Resources */,
DE018BE02A509B0600FF0AA3 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "SnapKit",
"repositoryURL": "https://github.com/SnapKit/SnapKit.git",
"state": {
"branch": null,
"revision": "f222cbdf325885926566172f6f5f06af95473158",
"version": "5.6.0"
}
}
]
},
"version": 1
}
Binary file not shown.
66 changes: 34 additions & 32 deletions Box42/Bookmark/View/Button/BookmarkCreateButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BookmarkCreateButton: NSButton {
self.isBordered = false
self.wantsLayer = true
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
self.layer?.backgroundColor = NSColor(hex: "#FFCE51").cgColor

let trackingArea = NSTrackingArea(rect: self.bounds, options: [.mouseEnteredAndExited, .activeAlways], owner: self, userInfo: nil)
self.addTrackingArea(trackingArea)
Expand All @@ -28,41 +28,43 @@ class BookmarkCreateButton: NSButton {

override func mouseEntered(with event: NSEvent) {
super.mouseEntered(with: event)

let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
bgColorAnimation.fromValue = WindowButtonUI.color.opacityWhite
bgColorAnimation.toValue = WindowButtonUI.color.maximize
bgColorAnimation.duration = WindowButtonUI.animation.duration

let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius
cornerAnimation.toValue = WindowButtonUI.size.cornerRadius / 2
cornerAnimation.duration = WindowButtonUI.animation.duration

self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")

self.layer?.backgroundColor = WindowButtonUI.color.maximize
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius / 2
self.layer?.backgroundColor = NSColor(hex: "#FFCE51").withAlphaComponent(0.5).cgColor

// let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
// bgColorAnimation.fromValue = WindowButtonUI.color.opacityWhite
// bgColorAnimation.toValue = WindowButtonUI.color.maximize
// bgColorAnimation.duration = WindowButtonUI.animation.duration
//
// let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
// cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius
// cornerAnimation.toValue = WindowButtonUI.size.cornerRadius / 2
// cornerAnimation.duration = WindowButtonUI.animation.duration
//
// self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
// self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")
//
// self.layer?.backgroundColor = WindowButtonUI.color.maximize
// self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius / 2
}

override func mouseExited(with event: NSEvent) {
super.mouseExited(with: event)

let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
bgColorAnimation.fromValue = WindowButtonUI.color.maximize
bgColorAnimation.toValue = WindowButtonUI.color.opacityWhite
bgColorAnimation.duration = WindowButtonUI.animation.duration
self.layer?.backgroundColor = NSColor(hex: "#FFCE51").cgColor

let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius / 2
cornerAnimation.toValue = WindowButtonUI.size.cornerRadius
cornerAnimation.duration = WindowButtonUI.animation.duration

self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")

self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
// let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
// bgColorAnimation.fromValue = WindowButtonUI.color.maximize
// bgColorAnimation.toValue = WindowButtonUI.color.opacityWhite
// bgColorAnimation.duration = WindowButtonUI.animation.duration
//
// let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
// cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius / 2
// cornerAnimation.toValue = WindowButtonUI.size.cornerRadius
// cornerAnimation.duration = WindowButtonUI.animation.duration
//
// self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
// self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")
//
// self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
// self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
}
}
66 changes: 33 additions & 33 deletions Box42/Bookmark/View/Button/BookmarkDeleteButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BookmarkDeleteButton: NSButton {
self.isBordered = false
self.wantsLayer = true
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
self.layer?.backgroundColor = NSColor(hex: "#F36161").cgColor

let trackingArea = NSTrackingArea(rect: self.bounds, options: [.mouseEnteredAndExited, .activeAlways], owner: self, userInfo: nil)
self.addTrackingArea(trackingArea)
Expand All @@ -28,41 +28,41 @@ class BookmarkDeleteButton: NSButton {

override func mouseEntered(with event: NSEvent) {
super.mouseEntered(with: event)

let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
bgColorAnimation.fromValue = WindowButtonUI.color.opacityWhite
bgColorAnimation.toValue = WindowButtonUI.color.close
bgColorAnimation.duration = WindowButtonUI.animation.duration

let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius
cornerAnimation.toValue = WindowButtonUI.size.cornerRadius / 2
cornerAnimation.duration = WindowButtonUI.animation.duration

self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")

self.layer?.backgroundColor = WindowButtonUI.color.close
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius / 2
self.layer?.backgroundColor = NSColor(hex: "#F36161").withAlphaComponent(0.5).cgColor
// let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
// bgColorAnimation.fromValue = WindowButtonUI.color.opacityWhite
// bgColorAnimation.toValue = WindowButtonUI.color.close
// bgColorAnimation.duration = WindowButtonUI.animation.duration
//
// let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
// cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius
// cornerAnimation.toValue = WindowButtonUI.size.cornerRadius / 2
// cornerAnimation.duration = WindowButtonUI.animation.duration
//
// self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
// self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")
//
// self.layer?.backgroundColor = WindowButtonUI.color.close
// self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius / 2
}

override func mouseExited(with event: NSEvent) {
super.mouseExited(with: event)

let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
bgColorAnimation.fromValue = WindowButtonUI.color.close
bgColorAnimation.toValue = WindowButtonUI.color.opacityWhite
bgColorAnimation.duration = WindowButtonUI.animation.duration
let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius / 2
cornerAnimation.toValue = WindowButtonUI.size.cornerRadius
cornerAnimation.duration = WindowButtonUI.animation.duration

self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")

self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
self.layer?.backgroundColor = NSColor(hex: "#F36161").cgColor
// let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
// bgColorAnimation.fromValue = WindowButtonUI.color.close
// bgColorAnimation.toValue = WindowButtonUI.color.opacityWhite
// bgColorAnimation.duration = WindowButtonUI.animation.duration
//
// let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
// cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius / 2
// cornerAnimation.toValue = WindowButtonUI.size.cornerRadius
// cornerAnimation.duration = WindowButtonUI.animation.duration
//
// self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
// self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")
//
// self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
// self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
}
}
66 changes: 34 additions & 32 deletions Box42/Bookmark/View/Button/BookmarkUpdateButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BookmarkUpdateButton: NSButton {
self.isBordered = false
self.wantsLayer = true
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
self.layer?.backgroundColor = NSColor(hex: "#76DF7A").cgColor

let trackingArea = NSTrackingArea(rect: self.bounds, options: [.mouseEnteredAndExited, .activeAlways], owner: self, userInfo: nil)
self.addTrackingArea(trackingArea)
Expand All @@ -28,42 +28,44 @@ class BookmarkUpdateButton: NSButton {

override func mouseEntered(with event: NSEvent) {
super.mouseEntered(with: event)

let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
bgColorAnimation.fromValue = WindowButtonUI.color.opacityWhite
bgColorAnimation.toValue = WindowButtonUI.color.minimize
bgColorAnimation.duration = WindowButtonUI.animation.duration

let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius
cornerAnimation.toValue = WindowButtonUI.size.cornerRadius / 2
cornerAnimation.duration = WindowButtonUI.animation.duration

self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")

self.layer?.backgroundColor = WindowButtonUI.color.minimize
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius / 2
self.layer?.backgroundColor = NSColor(hex: "#76DF7A").withAlphaComponent(0.5).cgColor

// let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
// bgColorAnimation.fromValue = WindowButtonUI.color.opacityWhite
// bgColorAnimation.toValue = WindowButtonUI.color.minimize
// bgColorAnimation.duration = WindowButtonUI.animation.duration
//
// let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
// cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius
// cornerAnimation.toValue = WindowButtonUI.size.cornerRadius / 2
// cornerAnimation.duration = WindowButtonUI.animation.duration
//
// self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
// self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")
//
// self.layer?.backgroundColor = WindowButtonUI.color.minimize
// self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius / 2
}

override func mouseExited(with event: NSEvent) {
super.mouseExited(with: event)
self.layer?.backgroundColor = NSColor(hex: "#76DF7A").cgColor

let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
bgColorAnimation.fromValue = WindowButtonUI.color.minimize
bgColorAnimation.toValue = WindowButtonUI.color.opacityWhite
bgColorAnimation.duration = WindowButtonUI.animation.duration
let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius / 2
cornerAnimation.toValue = WindowButtonUI.size.cornerRadius
cornerAnimation.duration = WindowButtonUI.animation.duration

self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")

self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
// let bgColorAnimation = CABasicAnimation(keyPath: "backgroundColor")
// bgColorAnimation.fromValue = WindowButtonUI.color.minimize
// bgColorAnimation.toValue = WindowButtonUI.color.opacityWhite
// bgColorAnimation.duration = WindowButtonUI.animation.duration
//
// let cornerAnimation = CABasicAnimation(keyPath: "cornerRadius")
// cornerAnimation.fromValue = WindowButtonUI.size.cornerRadius / 2
// cornerAnimation.toValue = WindowButtonUI.size.cornerRadius
// cornerAnimation.duration = WindowButtonUI.animation.duration
//
// self.layer?.add(bgColorAnimation, forKey: "backgroundColorAnimation")
// self.layer?.add(cornerAnimation, forKey: "cornerRadiusAnimation")
//
// self.layer?.backgroundColor = WindowButtonUI.color.opacityWhite
// self.layer?.cornerRadius = WindowButtonUI.size.cornerRadius
}

override func mouseDown(with event: NSEvent) {
Expand Down
14 changes: 13 additions & 1 deletion Box42/Bookmark/View/Editor/BookmarkCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class BookmarkCell: NSTableCellView {
}

private func setupUI() {
let labels = [nameLabel, descriptionLabel]
for label in labels {
label.wantsLayer = true
label.layer?.cornerRadius = 15
label.layer?.borderColor = NSColor(red: 0.781, green: 0.781, blue: 0.781, alpha: 1).cgColor
label.layer?.borderWidth = 1

label.font = NSFont.systemFont(ofSize: 16, weight: .medium)
label.textColor = NSColor.black
}
addSubview(nameLabel)
addSubview(descriptionLabel)
addSubview(quickSlotButton)
Expand All @@ -36,6 +46,7 @@ class BookmarkCell: NSTableCellView {
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.width.lessThanOrEqualTo(200).priority(.high)
make.height.equalTo(30)
}

deleteButton.snp.makeConstraints { make in
Expand All @@ -57,6 +68,7 @@ class BookmarkCell: NSTableCellView {
make.left.equalTo(nameLabel.snp.right).offset(8)
make.right.lessThanOrEqualTo(quickSlotButton.snp.left).offset(-8)
make.width.greaterThanOrEqualTo(100).priority(.low) // 최소 너비와 낮은 우선순위 설정
make.height.equalTo(30)
}
}

Expand All @@ -73,7 +85,7 @@ class BookmarkCell: NSTableCellView {

quickSlotButton.target = self
quickSlotButton.action = #selector(quickSlotButtonclicked)

// NSColor(hex: "#E7E7E7").cgColor
}

@objc func deleteButtonClicked() {
Expand Down
14 changes: 13 additions & 1 deletion Box42/Bookmark/View/Editor/BookmarkCellManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ class BookmarkCellManager: NSTableCellView {
}

private func setupUI() {
let labels = [nameLabel, descriptionLabel]
for label in labels {
label.wantsLayer = true
label.layer?.cornerRadius = 15
label.layer?.borderColor = NSColor(red: 0.781, green: 0.781, blue: 0.781, alpha: 1).cgColor
label.layer?.borderWidth = 1

label.font = NSFont.systemFont(ofSize: 16, weight: .medium)
label.textColor = NSColor.black
}
addSubview(nameLabel)
addSubview(descriptionLabel)
addSubview(excuteButton)
Expand All @@ -34,12 +44,13 @@ class BookmarkCellManager: NSTableCellView {
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.width.lessThanOrEqualTo(200).priority(.high) // 최대 너비와 우선순위 설정
make.height.equalTo(30)
}

excuteButton.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-16)
make.width.equalTo(150)
make.width.equalTo(106 + 8)
make.height.equalTo(40)
}

Expand All @@ -48,6 +59,7 @@ class BookmarkCellManager: NSTableCellView {
make.left.equalTo(nameLabel.snp.right).offset(8)
make.right.lessThanOrEqualTo(excuteButton.snp.left).offset(-8)
make.width.greaterThanOrEqualTo(100).priority(.low) // 최소 너비와 낮은 우선순위 설정
make.height.equalTo(30)
}
}

Expand Down
Loading