Skip to content

Commit

Permalink
Merge pull request #1556 from Kajabi/SAGE-406_pl-deprecate-table-stri…
Browse files Browse the repository at this point in the history
…pes-sage-lib

[SAGE-406] Deprecate Sage Table Striping
  • Loading branch information
pixelflips authored Aug 17, 2022
2 parents d4263a4 + a7c5a93 commit 5e0a4bd
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/app/views/examples/shared/_props.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= sage_component SageCard, {} do %>
<div class="sage-table-wrapper sage-table-wrapper--scroll">
<div class="sage-table-wrapper__overflow">
<table class="sage-table sage-table--properties sage-table--striped docs-table">
<table class="sage-table sage-table--properties docs-table">
<thead>
<tr>
<th>Property</th>
Expand Down
10 changes: 5 additions & 5 deletions docs/app/views/examples/shared/_props_improved.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<% if defined?(props) %>
<div class="<%= SageClassnames::GRID_CARD %>">
<h3>Properties</h3>
<%= sage_table_for props, responsive: true, sortable: true, striped: true do | t | %>
<%= sage_table_for props, responsive: true, sortable: true do | t | %>
<% t.column :name, label: "Name" do | c | %>
<%= md("`#{c[:name]}`") %>
<% end %>
<% end %>
<% t.column :description, label: "Description" do | c | %>
<%= md(c[:description], use_sage_type: true) %>
<% end %>
<% end %>
<% t.column :type, label: "Type" do | c | %>
<%= md(c[:type]) %>
<% end %>
<% end %>
<% t.column :default, label: "Default" do | c | %>
<%= md(c[:default]) %>
<% end %>
<% end %>
<% end %>
</div>
<% end %>
2 changes: 1 addition & 1 deletion docs/app/views/pages/container.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)) %>
<% end %>

<%= sage_table_for SageTokens::CONTAINER_SPECS, striped: true, responsive: true do |t| %>
<%= sage_table_for SageTokens::CONTAINER_SPECS, responsive: true do |t| %>
<% t.column :container, label: "Container" do |c| %>
<%= c[:name] %>
<code><%= c[:alias] %></code>
Expand Down
1 change: 0 additions & 1 deletion docs/app/views/pages/gap.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<div class="<%= SageClassnames::TYPE_BLOCK %>">
<p>The following gap tokens are used throughout Sage:</p>
<%= sage_component SageTable, {
striped: true,
headers: [
"Token",
"Value",
Expand Down
1 change: 0 additions & 1 deletion docs/app/views/pages/spacing.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<div class="<%= SageClassnames::TYPE_BLOCK %>">
<p>The following spacing tokens are used throughout Sage:</p>
<%= sage_component SageTable, {
striped: true,
headers: ["Token", "Value"],
rows: sage_spacers,
} %>
Expand Down
4 changes: 1 addition & 3 deletions docs/lib/sage_rails/app/helpers/sage_table_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def sortable_title
end

class SageTableFor
attr_reader :caption, :caption_side, :columns, :condensed, :template, :id, :class_name, :collection, :has_borders, :row_proc, :sortable, :responsive, :skip_headers, :striped, :reset_above, :reset_below
attr_reader :caption, :caption_side, :columns, :condensed, :template, :id, :class_name, :collection, :has_borders, :row_proc, :sortable, :responsive, :skip_headers, :reset_above, :reset_below
delegate :content_tag, :tag, to: :template

def initialize(template, collection, opts={})
Expand All @@ -96,7 +96,6 @@ def initialize(template, collection, opts={})
@responsive = opts[:responsive]
@skip_headers = opts[:skip_headers]
@sortable = opts[:sortable]
@striped = opts[:striped]
@id = opts[:id]
@columns = []
end
Expand Down Expand Up @@ -133,7 +132,6 @@ def table_contents
table_classes = "sage-table"
table_classes << " sage-table--condensed" if condensed
table_classes << " sage-table--sortable" if sortable
table_classes << " sage-table--striped" if striped
table_classes << " #{class_name}" if class_name

content_tag "table", id: id, class: table_classes do
Expand Down
1 change: 0 additions & 1 deletion docs/lib/sage_rails/app/sage_components/sage_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class SageTable < SageComponent
responsive: [:optional, TrueClass],
rows: [:optional, Array],
selectable: [:optional, TrueClass],
striped: [:optional, TrueClass],
})
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ is_responsive = component.responsive.present? ? component.responsive : true

<table class="
sage-table
<%= "sage-table--striped" if component.striped %>
<%= "sage-table--selectable" if component.selectable %>
<%= "sage-table--condensed" if component.condensed %>
"
Expand Down
10 changes: 0 additions & 10 deletions packages/sage-assets/lib/stylesheets/components/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ $-table-overflow-indicator-opacity: 0.95;
$-table-overflow-indicator-gradient: linear-gradient(90deg, $-table-overflow-indicator-color-start 0%, rgba($-table-overflow-indicator-color-end, $-table-overflow-indicator-opacity) 100%);

// Other
$-table-row-color-stripe: sage-color(grey, 200);
$-table-row-color-hover: sage-color(grey, 100);
$-table-cell-focus: sage-color(charcoal, 300);
$-table-cell-truncate-width: 6.5em;
Expand Down Expand Up @@ -160,15 +159,6 @@ $-table-avatar-width: rem(32px);
}
}

// Alternating rows of striped colors
.sage-table--striped {
tbody {
tr:nth-child(odd) {
background-color: $-table-row-color-stripe;
}
}
}

// Sortable rows
.sage-table--sortable {
.sage-table__sort-link {
Expand Down
4 changes: 0 additions & 4 deletions packages/sage-react/lib/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const Table = ({
hasDataBeyondCurrentRows,
headers,
isResponsive,
isStriped,
onSelectRowHook,
resetAbove,
resetBelow,
Expand Down Expand Up @@ -69,7 +68,6 @@ export const Table = ({
'sage-table',
{
'sage-table--selectable': selectable,
'sage-table--striped': isStriped,
}
);

Expand Down Expand Up @@ -342,7 +340,6 @@ Table.defaultProps = {
hasDataBeyondCurrentRows: false,
headers: [],
isResponsive: true,
isStriped: false,
onSelectRowHook: null,
resetAbove: false,
resetBelow: false,
Expand Down Expand Up @@ -370,7 +367,6 @@ Table.propTypes = {
PropTypes.shape({}),
]),
isResponsive: PropTypes.bool,
isStriped: PropTypes.bool,
onSelectRowHook: PropTypes.func,
resetAbove: PropTypes.bool,
resetBelow: PropTypes.bool,
Expand Down

0 comments on commit 5e0a4bd

Please sign in to comment.