@@ -8,28 +8,37 @@ class Badge
88 # :danger, :gray, :success, :warning).
99 class Dot < ViewComponent ::Base
1010 CLASSES = {
11- alternative : [ "bg-heading" , "h-1.5" , "me-1" , "rounded-full" , "w-1.5" ] ,
12- brand : [ "bg-fg-brand-strong" , "h-1.5" , "me-1" , "rounded-full" , "w-1.5" ] ,
13- danger : [ "bg-fg-danger-strong" , "h-1.5" , "me-1" , "rounded-full" , "w-1.5" ] ,
14- gray : [ "bg-heading" , "h-1.5" , "me-1" , "rounded-full" , "w-1.5" ] ,
15- success : [ "bg-fg-success-strong" , "h-1.5" , "me-1" , "rounded-full" , "w-1.5" ] ,
16- warning : [ "bg-fg-warning" , "h-1.5" , "me-1" , "rounded-full" , "w-1.5" ]
11+ alternative : [ "bg-heading" , "me-1" , "rounded-full" ] ,
12+ brand : [ "bg-fg-brand-strong" , "me-1" , "rounded-full" ] ,
13+ danger : [ "bg-fg-danger-strong" , "me-1" , "rounded-full" ] ,
14+ gray : [ "bg-heading" , "me-1" , "rounded-full" ] ,
15+ success : [ "bg-fg-success-strong" , "me-1" , "rounded-full" ] ,
16+ warning : [ "bg-fg-warning" , "me-1" , "rounded-full" ]
17+ } . freeze
18+
19+ SIZES = {
20+ default : [ "h-1.5" , "w-1.5" ]
1721 } . freeze
1822
1923 class << self
20- def classes ( style : :brand )
21- CLASSES . fetch ( style )
24+ def classes ( size : :default , style : :brand )
25+ CLASSES . fetch ( style ) + sizes . fetch ( size )
26+ end
27+
28+ def sizes
29+ SIZES
2230 end
2331 end
2432
25- attr_reader :style
33+ attr_reader :size , : style
2634
27- def initialize ( style : :brand )
35+ def initialize ( size : :default , style : :brand )
36+ @size = size
2837 @style = style
2938 end
3039
3140 def call
32- content_tag ( :span , nil , class : self . class . classes ( style : style ) )
41+ content_tag ( :span , nil , class : self . class . classes ( size : size , style : style ) )
3342 end
3443 end
3544 end
0 commit comments