Skip to content

Commit

Permalink
Change lightbulb button style
Browse files Browse the repository at this point in the history
  • Loading branch information
terlan98 committed Dec 2, 2023
1 parent b4523f3 commit f79ace5
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions CodeEditor/Sources/CodeEditor/LighbulbButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,23 @@ final class LightbulbButton: UIButton {
fatalError("not implemented")
}


private func setup() {
let image = UIImage(systemName: "lightbulb.fill")
setImage(image, for: .normal)
imageView?.contentMode = .scaleAspectFit
imageView?.tintColor = .yellow
self.backgroundColor = UIColor(netHex: 0xB54EFE)
self.layer.cornerRadius = 6

let image = UIImage(named: "SuggestedFeedbackSymbol")?.withRenderingMode(.alwaysTemplate)
let customImgView = UIImageView()
customImgView.image = image
customImgView.tintColor = .white
customImgView.contentMode = .scaleAspectFit
self.addSubview(customImgView)

customImgView.translatesAutoresizingMaskIntoConstraints = false
customImgView.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
customImgView.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
customImgView.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.5) .isActive = true
customImgView.heightAnchor.constraint(equalTo: self.heightAnchor, multiplier: 0.6) .isActive = true

addTarget(self, action: #selector(self.onLightBulbTap), for: .touchUpInside)
}

Expand All @@ -39,3 +50,9 @@ final class LightbulbButton: UIButton {
toggleShowAddFeedback()
}
}

#Preview {
LightbulbButton(frame: .init(x: 0, y: 0, width: 350, height: 350),
setSelectedFeedbackSuggestionId: {},
toggleShowAddFeedback: {})
}

0 comments on commit f79ace5

Please sign in to comment.