-
Notifications
You must be signed in to change notification settings - Fork 22
/
radios.rb
44 lines (35 loc) · 843 Bytes
/
radios.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module GOVUKDesignSystemFormBuilder
module Containers
class Radios < Base
include Traits::Hint
def initialize(builder, inline:, small:, classes:)
super(builder, nil, nil)
@inline = inline
@small = small
@classes = classes
end
def html
tag.div(**options) { yield }
end
private
def options
{
class: classes,
data: { module: %(#{brand}-radios) }
}
end
def classes
[%(#{brand}-radios), inline_class, small_class, custom_classes].flatten.compact
end
def inline_class
%(#{brand}-radios--inline) if @inline
end
def small_class
%(#{brand}-radios--small) if @small
end
def custom_classes
Array.wrap(@classes)
end
end
end
end