Skip to content

Commit

Permalink
Add support for borderless cards (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillplatonov authored Apr 2, 2024
1 parent 2d08f9b commit b56fed7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/polaris_view_components.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions app/assets/stylesheets/polaris_view_components/card.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard {
padding-top: var(--p-space-400);
}
}

&.Polaris-LegacyCard--borderless {
border: none;
box-shadow: none;

&::before {
content: none;
}
}
}
5 changes: 4 additions & 1 deletion app/components/polaris/card_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ def initialize(
actions: [],
sectioned: true,
subdued: false,
borders: true,
footer_action_alignment: FOOTER_ACTION_ALIGNMENT_DEFAULT,
**system_arguments
)
@title = title
@actions = actions
@sectioned = sectioned
@subdued = subdued
@borders = borders
@footer_action_alignment = footer_action_alignment
@system_arguments = system_arguments
end
Expand All @@ -40,7 +42,8 @@ def system_arguments
opts[:classes],
"Polaris-LegacyCard",
"Polaris-LegacyCard--subdued": @subdued,
"Polaris-LegacyCard--withoutTitle": @title.blank?
"Polaris-LegacyCard--withoutTitle": @title.blank?,
"Polaris-LegacyCard--borderless": !@borders
)
end
end
Expand Down
3 changes: 3 additions & 0 deletions demo/app/previews/card_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ def section_with_borders

def without_title
end

def borderless
end
end
3 changes: 3 additions & 0 deletions demo/app/previews/card_component_preview/borderless.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= polaris_card(title: "Online store dashboard", borders: false) do %>
<p>View a summary of your online store’s performance.</p>
<% end %>

0 comments on commit b56fed7

Please sign in to comment.