mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-10 07:55:21 +02:00
Remove stale class
This commit is contained in:
parent
1a64336905
commit
6fcc8cf002
1 changed files with 0 additions and 102 deletions
|
@ -1,102 +0,0 @@
|
||||||
module ButtonStylable
|
|
||||||
VARIANTS = {
|
|
||||||
primary: {
|
|
||||||
container_classes: "text-inverse bg-inverse hover:bg-inverse-hover disabled:bg-gray-500 theme-dark:disabled:bg-gray-400",
|
|
||||||
icon_classes: "fg-inverse"
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
container_classes: "text-secondary bg-gray-50 theme-dark:bg-gray-700 hover:bg-gray-100 theme-dark:hover:bg-gray-600 disabled:bg-gray-200 theme-dark:disabled:bg-gray-600",
|
|
||||||
icon_classes: "fg-primary"
|
|
||||||
},
|
|
||||||
destructive: {
|
|
||||||
container_classes: "text-inverse bg-red-500 theme-dark:bg-red-400 hover:bg-red-600 theme-dark:hover:bg-red-500 disabled:bg-red-200 theme-dark:disabled:bg-red-600",
|
|
||||||
icon_classes: "fg-white"
|
|
||||||
},
|
|
||||||
outline: {
|
|
||||||
container_classes: "text-primary border border-secondary bg-transparent hover:bg-surface-hover",
|
|
||||||
icon_classes: "fg-gray"
|
|
||||||
},
|
|
||||||
outline_destructive: {
|
|
||||||
container_classes: "text-destructive border border-secondary bg-transparent hover:bg-gray-100 theme-dark:hover:bg-gray-700",
|
|
||||||
icon_classes: "fg-gray"
|
|
||||||
},
|
|
||||||
ghost: {
|
|
||||||
container_classes: "text-primary bg-transparent hover:bg-gray-100 theme-dark:hover:bg-gray-700",
|
|
||||||
icon_classes: "fg-gray"
|
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
container_classes: "hover:bg-gray-100 theme-dark:hover:bg-gray-700",
|
|
||||||
icon_classes: "fg-gray"
|
|
||||||
},
|
|
||||||
icon_inverse: {
|
|
||||||
container_classes: "bg-inverse hover:bg-inverse-hover",
|
|
||||||
icon_classes: "fg-inverse"
|
|
||||||
}
|
|
||||||
}.freeze
|
|
||||||
|
|
||||||
SIZES = {
|
|
||||||
sm: {
|
|
||||||
padding_classes: "px-2 py-1",
|
|
||||||
icon_padding_classes: "p-2",
|
|
||||||
radius_classes: "rounded-md",
|
|
||||||
text_classes: "text-sm",
|
|
||||||
icon_classes: "w-4 h-4"
|
|
||||||
},
|
|
||||||
md: {
|
|
||||||
padding_classes: "px-3 py-2",
|
|
||||||
icon_padding_classes: "p-2",
|
|
||||||
radius_classes: "rounded-lg",
|
|
||||||
text_classes: "text-sm",
|
|
||||||
icon_classes: "w-5 h-5"
|
|
||||||
},
|
|
||||||
lg: {
|
|
||||||
padding_classes: "px-4 py-3",
|
|
||||||
icon_padding_classes: "p-2",
|
|
||||||
radius_classes: "rounded-xl",
|
|
||||||
text_classes: "text-base",
|
|
||||||
icon_classes: "w-6 h-6"
|
|
||||||
}
|
|
||||||
}.freeze
|
|
||||||
|
|
||||||
attr_reader :variant, :size, :extra_classes
|
|
||||||
|
|
||||||
def initialize(opts = {})
|
|
||||||
@variant = opts.delete(:variant) || :primary
|
|
||||||
@size = opts.delete(:size) || :md
|
|
||||||
@extra_classes = opts.delete(:class)
|
|
||||||
end
|
|
||||||
|
|
||||||
def container_classes(override_classes = nil)
|
|
||||||
class_names(
|
|
||||||
"inline-flex items-center gap-1 font-medium whitespace-nowrap",
|
|
||||||
icon_only? ? size_data.dig(:icon_padding_classes) : size_data.dig(:padding_classes),
|
|
||||||
size_data.dig(:radius_classes),
|
|
||||||
size_data.dig(:text_classes),
|
|
||||||
variant_data.dig(:container_classes)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def icon_classes
|
|
||||||
class_names(
|
|
||||||
size_data.dig(:icon_classes),
|
|
||||||
variant_data.dig(:icon_classes)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def icon_only?
|
|
||||||
variant.in?([ :icon, :icon_inverse ])
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
def variant_data
|
|
||||||
self.class::VARIANTS.dig(variant.to_s.underscore.to_sym)
|
|
||||||
end
|
|
||||||
|
|
||||||
def size_data
|
|
||||||
self.class::SIZES.dig(size.to_sym)
|
|
||||||
end
|
|
||||||
|
|
||||||
def known_override_classes
|
|
||||||
[ "hidden", "rounded-full", "w-full", "justify-center", "justify-start" ]
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Add table
Add a link
Reference in a new issue