Skip to content

Commit 506cd3b

Browse files
committed
More stuff
1 parent 27bf1f4 commit 506cd3b

File tree

6 files changed

+16
-30
lines changed

6 files changed

+16
-30
lines changed

app/components/avo/empty_state_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Avo::EmptyStateComponent < Avo::BaseComponent
44
VIEW_TYPE = _Union(:map, :table, :grid)
55

66
prop :message, _Nilable(String), reader: :public
7-
prop :view_type, VIEW_TYPE, default: :table, reader: :public, &:to_sym
7+
prop :view_type, VIEW_TYPE, default: VIEW_TYPE[:table], reader: :public, &:to_sym
88
prop :add_background, _Boolean, default: false, reader: :public
99
prop :by_association, _Boolean, default: false, reader: :public
1010

app/components/avo/modal_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class Avo::ModalComponent < Avo::BaseComponent
44
SIZE = _Union(:md, :xl)
55

6-
prop :width, SIZE, default: :md
6+
prop :width, SIZE, default: SIZE[:md]
77
prop :body_class, _Nilable(String)
88

99
renders_one :heading
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# frozen_string_literal: true
22

33
class Avo::ReferrerParamsComponent < Avo::BaseComponent
4-
attr_reader :back_path
5-
6-
def initialize(back_path: nil)
7-
@back_path = back_path
8-
end
4+
prop :back_path, _Nilable(String), reader: :public
95
end

app/components/avo/row_component.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# frozen_string_literal: true
22

33
class Avo::RowComponent < Avo::BaseComponent
4-
attr_reader :classes
4+
prop :classes, _Nilable(String)
5+
prop :data, Hash, default: -> { {} }
56

67
renders_one :body
7-
8-
def initialize(classes: nil, data: {})
9-
@classes = classes
10-
@data = data
11-
end
128
end
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

33
class Avo::RowSelectorComponent < Avo::BaseComponent
4-
def initialize(floating: false, size: :md)
5-
@floating = floating
6-
@size = size
7-
end
4+
SIZE = _Union(:md, :lg)
5+
6+
prop :floating, _Boolean, default: false
7+
prop :size, SIZE, default: SIZE[:md]
88
end

app/components/avo/tab_group_component.rb

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
# frozen_string_literal: true
22

33
class Avo::TabGroupComponent < Avo::BaseComponent
4-
attr_reader :group
5-
attr_reader :index
6-
attr_reader :view
7-
attr_reader :form
8-
attr_reader :resource
4+
prop :resource, Avo::BaseResource, reader: :public
5+
prop :group, _Any, reader: :public
6+
prop :index, _Any, reader: :public
7+
prop :form, _Nilable(ActionView::Helpers::FormBuilder), reader: :public
8+
prop :params, _Any
9+
prop :view, _Any, reader: :public
910

1011
delegate :group_param, to: :@group
1112

12-
def initialize(resource:, group:, index:, form:, params:, view:)
13-
@resource = resource
14-
@group = group
15-
@index = index
16-
@form = form
17-
@params = params
18-
@view = view
19-
13+
def after_initialize
2014
@group.index = index
2115
end
2216

0 commit comments

Comments
 (0)