css: refactor CSS to use Tailwind-style utility classes.

Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
This commit is contained in:
evazion
2021-02-15 18:28:53 -06:00
parent 7b0fee6333
commit 1e80540a04
49 changed files with 245 additions and 450 deletions

View File

@@ -35,12 +35,13 @@ class TableBuilder
end
end
attr_reader :columns, :table_attributes, :items
attr_reader :columns, :table_attributes, :row_attributes, :items
def initialize(items, **table_attributes)
def initialize(items, tr: {}, **table_attributes)
@items = items
@columns = []
@table_attributes = { class: "striped", **table_attributes }
@row_attributes = tr
if items.respond_to?(:model_name)
@table_attributes[:id] ||= "#{items.model_name.plural.dasherize}-table"
@@ -58,6 +59,7 @@ class TableBuilder
{
id: "#{item.model_name.singular.dasherize}-#{item.id}",
**row_attributes,
**ApplicationController.helpers.data_attributes_for(item, "data", item.html_data_attributes)
}
end