Skip to content
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
21 changes: 21 additions & 0 deletions Box42/FunctionButton/Model/FunctionButtonUI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// FunctionButtonUI.swift
// Box42
//
// Created by Chanhee Kim on 8/27/23.
//

import AppKit

struct FunctionButtonUI {
struct size {
static let font: CGFloat = 14
}

struct animation {
}

struct color {
static let pinText = NSColor(hex: "#696969")
}
}
38 changes: 19 additions & 19 deletions Box42/FunctionButton/View/BoxFunctionViewGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SnapKit

class BoxFunctionViewGroup: NSView {
lazy var preferenceButton: PreferenceButtonView = PreferenceButtonView(image: NSImage(imageLiteralResourceName: "plus"), completion: { self.preferenceAction?() })
lazy var pinButton: PinButtonView = PinButtonView(image: NSImage(imageLiteralResourceName: "pin"), completion: { self.pinAction?() })
lazy var pinButton: PinButtonView = PinButtonView(image: NSImage(imageLiteralResourceName: "Pin icon"), completion: { self.pinAction?() })
lazy var quitButton: QuitButtonView = QuitButtonView(image: NSImage(imageLiteralResourceName: "figure.snowboarding"), completion: { self.quitAction?() })
lazy var boxButton: BoxFunctionButtonView = BoxFunctionButtonView(image: NSImage(imageLiteralResourceName: "shippingbox"), completion: { self.boxAction?() })
lazy var divider: NSBox = TopDivider(completion: { self.dividerAction?() })
Expand Down Expand Up @@ -47,29 +47,29 @@ class BoxFunctionViewGroup: NSView {
make.left.right.equalToSuperview()
}

preferenceButton.snp.makeConstraints { make in
pinButton.snp.makeConstraints { make in
make.top.equalTo(divider).offset(10)
make.bottom.equalToSuperview()
make.left.equalToSuperview()
make.width.equalTo(pinButton)
}

pinButton.snp.makeConstraints { make in
make.top.bottom.equalTo(preferenceButton)
make.left.equalTo(preferenceButton.snp.right).offset(10)
make.width.equalTo(quitButton)
}

quitButton.snp.makeConstraints { make in
make.top.bottom.equalTo(preferenceButton)
make.left.equalTo(pinButton.snp.right).offset(10)
make.width.equalTo(boxButton)
}

boxButton.snp.makeConstraints { make in
make.top.bottom.equalTo(preferenceButton)
make.left.equalTo(quitButton.snp.right).offset(10)
make.right.equalToSuperview()
}
// preferenceButton.snp.makeConstraints { make in
// make.top.bottom.equalTo(pinButton)
// make.left.equalTo(pinButton.snp.right).offset(10)
// make.width.equalTo(quitButton)
// }
//
// quitButton.snp.makeConstraints { make in
// make.top.bottom.equalTo(pinButton)
// make.left.equalTo(preferenceButton.snp.right).offset(10)
// make.width.equalTo(boxButton)
// }
//
// boxButton.snp.makeConstraints { make in
// make.top.bottom.equalTo(pinButton)
// make.left.equalTo(quitButton.snp.right).offset(10)
// make.right.equalToSuperview()
// }
}
}
18 changes: 17 additions & 1 deletion Box42/FunctionButton/View/PinButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,33 @@ import AppKit
class PinButtonView: NSButton {

private var callback: (() -> Void)?
private var pinBoxLabel: NSTextField!

init(image: NSImage, completion: @escaping () -> Void) {
super.init(frame: .zero)

self.image = image
self.isBordered = false // 버튼의 테두리를 제거
self.isBordered = false
self.wantsLayer = true
self.layer?.backgroundColor = NSColor.clear.cgColor
self.target = self
self.action = #selector(pin)
self.callback = completion

pinBoxLabel = NSTextField(labelWithString: "Pin Box")
pinBoxLabel.font = NSFont(name: "Inter", size: FunctionButtonUI.size.font)
pinBoxLabel.textColor = FunctionButtonUI.color.pinText
pinBoxLabel.backgroundColor = NSColor.clear
pinBoxLabel.isBordered = false

self.addSubview(pinBoxLabel) // 라벨을 버튼에 추가

// 레이아웃을 설정 (예: AutoLayout)
pinBoxLabel.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
pinBoxLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor),
pinBoxLabel.leadingAnchor.constraint(equalTo: self.trailingAnchor, constant: 8)
])
}

required init?(coder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Pin icon.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Pin icon_45.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.