Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/components/primer/open_project/fieldset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Fieldset < Primer::Component
# @param legend_text [String] A legend should be short and concise. The String will also be read by assistive technology.
# @param visually_hide_legend [Boolean] Controls if the legend is visible. If `true`, screen reader only text will be added.
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(legend_text: nil, visually_hide_legend: false, **system_arguments) # rubocop:disable Lint/MissingSuper
def initialize(legend_text: nil, visually_hide_legend: false, **system_arguments)
@legend_text = legend_text
@visually_hide_legend = visually_hide_legend
@system_arguments = deny_tag_argument(**system_arguments)
Expand All @@ -40,7 +40,7 @@ class LegendComponent < Primer::Component

attr_reader :text

def initialize(text: nil, visually_hide_legend: false, **system_arguments) # rubocop:disable Lint/MissingSuper
def initialize(text: nil, visually_hide_legend: false, **system_arguments)
@text = text

@system_arguments = deny_tag_argument(**system_arguments)
Expand Down
4 changes: 2 additions & 2 deletions app/components/primer/open_project/flex_layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def render?
# no slot provided
return false if rows.empty? && columns.empty? && boxes.empty?

if [rows, columns, boxes].count { |arr| !arr.empty? } == 1
if [rows, columns, boxes].one? { |arr| !arr.empty? }
# only rows or columns or boxes are used
true
elsif [rows, columns, boxes].count { |arr| !arr.empty? } > 1
elsif [rows, columns, boxes].many? { |arr| !arr.empty? }
# rows, columns and boxes are used together, which is not allowed
raise ArgumentError, "You can't mix row, column and box slots"
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/primer/open_project/inline_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class InlineMessage < Primer::Component
# @param scheme [Symbol] <%= one_of(Primer::OpenProject::InlineMessage::SCHEME_OPTIONS) %>
# @param size [Symbol] <%= one_of(Primer::OpenProject::InlineMessage::SIZE_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(scheme:, size: DEFAULT_SIZE, **system_arguments) # rubocop:disable Lint/MissingSuper
def initialize(scheme:, size: DEFAULT_SIZE, **system_arguments)
resolved_scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme)
resolved_size = fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)

Expand Down
2 changes: 1 addition & 1 deletion app/components/primer/open_project/page_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def render?
end

def render_mobile_menu?
actions.count > 1
actions.many?
end

def show_state?
Expand Down
4 changes: 1 addition & 3 deletions app/components/primer/open_project/pagination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ def build_component_data(page)
key = :"page-#{page[:num]}-break"
content = "…"

props.merge!(
role: "presentation"
)
props[:role] = "presentation"
end

props[:class] = class_names("Page", props[:class])
Expand Down
32 changes: 16 additions & 16 deletions app/components/primer/open_project/sub_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SubHeader < Primer::Component
@mobile_actions ||= []
mobile_component = Primer::Beta::IconButton.new(display: MOBILE_ACTIONS_DISPLAY,
**icon_args)
@mobile_actions.push({ component: mobile_component, block: block})
@mobile_actions.push({ component: mobile_component, block: block })

Primer::OpenProject::SubHeader::Button.new(display: DESKTOP_ACTIONS_DISPLAY, **kwargs)
end
Expand All @@ -65,9 +65,9 @@ class SubHeader < Primer::Component
mobile_component = Primer::OpenProject::SubHeader::Menu.new(icon_only: true,
display: MOBILE_ACTIONS_DISPLAY,
**kwargs)
@mobile_actions.push({ component: mobile_component, block: block})
@mobile_actions.push({ component: mobile_component, block: block })

Primer::OpenProject::SubHeader::Menu.new(icon_only: icon_only,display: DESKTOP_ACTIONS_DISPLAY, **kwargs)
Primer::OpenProject::SubHeader::Menu.new(icon_only: icon_only, display: DESKTOP_ACTIONS_DISPLAY, **kwargs)
},
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ class SubHeader < Primer::Component
if icon_only
Primer::Beta::IconButton.new(**icon_args)
else
@mobile_filter_button = Primer::Beta::IconButton.new(display: MOBILE_ACTIONS_DISPLAY,
@mobile_filter_button = Primer::Beta::IconButton.new(display: MOBILE_ACTIONS_DISPLAY,
**icon_args)

Primer::OpenProject::SubHeader::Button.new(display: DESKTOP_ACTIONS_DISPLAY, **kwargs)
Expand Down Expand Up @@ -194,18 +194,18 @@ class SubHeader < Primer::Component
}

renders_one :segmented_control, lambda { |**system_arguments, &block|
deny_tag_argument(**system_arguments)
system_arguments[:mr] ||= 2
system_arguments = set_as_hidden_filter_target(system_arguments)

@segmented_control_block = block
@mobile_segmented_control = Primer::OpenProject::SubHeader::SegmentedControl.new(
hide_labels: true,
display: MOBILE_ACTIONS_DISPLAY,
**system_arguments
)

Primer::OpenProject::SubHeader::SegmentedControl.new(display: DESKTOP_ACTIONS_DISPLAY, **system_arguments)
deny_tag_argument(**system_arguments)
system_arguments[:mr] ||= 2
system_arguments = set_as_hidden_filter_target(system_arguments)

@segmented_control_block = block
@mobile_segmented_control = Primer::OpenProject::SubHeader::SegmentedControl.new(
hide_labels: true,
display: MOBILE_ACTIONS_DISPLAY,
**system_arguments
)

Primer::OpenProject::SubHeader::SegmentedControl.new(display: DESKTOP_ACTIONS_DISPLAY, **system_arguments)
}

renders_one :text, lambda { |**system_arguments|
Expand Down