better_ui 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of better_ui might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +227 -209
- data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +138 -0
- data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +211 -0
- data/app/assets/javascripts/better_ui/controllers/toast_controller.js +161 -0
- data/app/assets/javascripts/better_ui/index.js +159 -0
- data/app/assets/javascripts/better_ui/toast_manager.js +77 -0
- data/app/assets/stylesheets/better_ui/application.css +30 -0
- data/app/components/better_ui/application/alert_component.html.erb +27 -0
- data/app/components/better_ui/application/alert_component.rb +202 -0
- data/app/components/better_ui/application/card_component.html.erb +24 -0
- data/app/components/better_ui/application/card_component.rb +53 -0
- data/app/components/better_ui/application/card_container_component.html.erb +8 -0
- data/app/components/better_ui/application/card_container_component.rb +14 -0
- data/app/components/better_ui/application/header_component.html.erb +88 -0
- data/app/components/better_ui/application/header_component.rb +188 -0
- data/app/components/better_ui/application/navbar_component.html.erb +294 -0
- data/app/components/better_ui/application/navbar_component.rb +249 -0
- data/app/components/better_ui/application/sidebar_component.html.erb +207 -0
- data/app/components/better_ui/application/sidebar_component.rb +318 -0
- data/app/components/better_ui/application/toast_component.html.erb +35 -0
- data/app/components/better_ui/application/toast_component.rb +223 -0
- data/app/components/better_ui/general/avatar_component.html.erb +19 -0
- data/app/components/better_ui/general/avatar_component.rb +171 -0
- data/app/components/better_ui/general/badge_component.html.erb +19 -0
- data/app/components/better_ui/general/badge_component.rb +123 -0
- data/app/components/better_ui/general/{breadcrumb/component.html.erb → breadcrumb_component.html.erb} +4 -4
- data/app/components/better_ui/general/breadcrumb_component.rb +130 -0
- data/app/components/better_ui/general/{button/component.html.erb → button_component.html.erb} +7 -7
- data/app/components/better_ui/general/button_component.rb +162 -0
- data/app/components/better_ui/general/heading_component.html.erb +25 -0
- data/app/components/better_ui/general/heading_component.rb +148 -0
- data/app/components/better_ui/general/icon_component.html.erb +2 -0
- data/app/components/better_ui/general/icon_component.rb +100 -0
- data/app/components/better_ui/general/link_component.html.erb +17 -0
- data/app/components/better_ui/general/link_component.rb +132 -0
- data/app/components/better_ui/general/panel_component.html.erb +27 -0
- data/app/components/better_ui/general/panel_component.rb +103 -0
- data/app/components/better_ui/general/spinner_component.html.erb +15 -0
- data/app/components/better_ui/general/spinner_component.rb +79 -0
- data/app/components/better_ui/general/table_component.html.erb +73 -0
- data/app/components/better_ui/general/table_component.rb +167 -0
- data/app/components/better_ui/theme_helper.rb +171 -0
- data/app/controllers/better_ui/application_controller.rb +1 -0
- data/app/controllers/better_ui/docs_controller.rb +34 -0
- data/app/views/components/better_ui/general/table/_custom_body_row.html.erb +17 -0
- data/app/views/components/better_ui/general/table/_custom_footer_rows.html.erb +17 -0
- data/app/views/components/better_ui/general/table/_custom_header_rows.html.erb +12 -0
- data/app/views/layouts/component_preview.html.erb +32 -0
- data/config/initializers/lookbook.rb +12 -12
- data/config/routes.rb +13 -0
- data/lib/better_ui/engine.rb +36 -5
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +24 -4
- data/lib/generators/better_ui/stylesheet_generator.rb +96 -0
- data/lib/generators/better_ui/templates/README +56 -0
- data/lib/generators/better_ui/templates/components/_avatar.scss +151 -0
- data/lib/generators/better_ui/templates/components/_badge.scss +142 -0
- data/lib/generators/better_ui/templates/components/_breadcrumb.scss +107 -0
- data/lib/generators/better_ui/templates/components/_button.scss +106 -0
- data/lib/generators/better_ui/templates/components/_card.scss +69 -0
- data/lib/generators/better_ui/templates/components/_heading.scss +180 -0
- data/lib/generators/better_ui/templates/components/_icon.scss +90 -0
- data/lib/generators/better_ui/templates/components/_link.scss +130 -0
- data/lib/generators/better_ui/templates/components/_panel.scss +144 -0
- data/lib/generators/better_ui/templates/components/_spinner.scss +132 -0
- data/lib/generators/better_ui/templates/components/_table.scss +105 -0
- data/lib/generators/better_ui/templates/components/_variables.scss +33 -0
- data/lib/generators/better_ui/templates/components_stylesheet.scss +66 -0
- metadata +145 -156
- data/app/components/better_ui/application/card/component.html.erb +0 -20
- data/app/components/better_ui/application/card/component.rb +0 -214
- data/app/components/better_ui/application/main/component.html.erb +0 -9
- data/app/components/better_ui/application/main/component.rb +0 -123
- data/app/components/better_ui/application/navbar/component.html.erb +0 -92
- data/app/components/better_ui/application/navbar/component.rb +0 -136
- data/app/components/better_ui/application/sidebar/component.html.erb +0 -227
- data/app/components/better_ui/application/sidebar/component.rb +0 -130
- data/app/components/better_ui/general/accordion/component.html.erb +0 -5
- data/app/components/better_ui/general/accordion/component.rb +0 -92
- data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
- data/app/components/better_ui/general/accordion/item_component.rb +0 -176
- data/app/components/better_ui/general/alert/component.html.erb +0 -32
- data/app/components/better_ui/general/alert/component.rb +0 -242
- data/app/components/better_ui/general/avatar/component.html.erb +0 -20
- data/app/components/better_ui/general/avatar/component.rb +0 -301
- data/app/components/better_ui/general/badge/component.html.erb +0 -23
- data/app/components/better_ui/general/badge/component.rb +0 -248
- data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
- data/app/components/better_ui/general/button/component.rb +0 -214
- data/app/components/better_ui/general/divider/component.html.erb +0 -10
- data/app/components/better_ui/general/divider/component.rb +0 -226
- data/app/components/better_ui/general/dropdown/component.html.erb +0 -25
- data/app/components/better_ui/general/dropdown/component.rb +0 -170
- data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
- data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
- data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
- data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
- data/app/components/better_ui/general/field/component.html.erb +0 -27
- data/app/components/better_ui/general/field/component.rb +0 -37
- data/app/components/better_ui/general/heading/component.html.erb +0 -22
- data/app/components/better_ui/general/heading/component.rb +0 -257
- data/app/components/better_ui/general/icon/component.html.erb +0 -7
- data/app/components/better_ui/general/icon/component.rb +0 -239
- data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
- data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
- data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
- data/app/components/better_ui/general/input/datetime/component.rb +0 -223
- data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
- data/app/components/better_ui/general/input/radio/component.rb +0 -230
- data/app/components/better_ui/general/input/select/component.html.erb +0 -16
- data/app/components/better_ui/general/input/select/component.rb +0 -184
- data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
- data/app/components/better_ui/general/input/select/select_component.rb +0 -37
- data/app/components/better_ui/general/input/text/component.html.erb +0 -5
- data/app/components/better_ui/general/input/text/component.rb +0 -171
- data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
- data/app/components/better_ui/general/input/textarea/component.rb +0 -166
- data/app/components/better_ui/general/link/component.html.erb +0 -18
- data/app/components/better_ui/general/link/component.rb +0 -258
- data/app/components/better_ui/general/modal/component.html.erb +0 -5
- data/app/components/better_ui/general/modal/component.rb +0 -47
- data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
- data/app/components/better_ui/general/modal/modal_component.rb +0 -160
- data/app/components/better_ui/general/pagination/component.html.erb +0 -85
- data/app/components/better_ui/general/pagination/component.rb +0 -216
- data/app/components/better_ui/general/panel/component.html.erb +0 -28
- data/app/components/better_ui/general/panel/component.rb +0 -249
- data/app/components/better_ui/general/progress/component.html.erb +0 -11
- data/app/components/better_ui/general/progress/component.rb +0 -160
- data/app/components/better_ui/general/spinner/component.html.erb +0 -35
- data/app/components/better_ui/general/spinner/component.rb +0 -93
- data/app/components/better_ui/general/table/component.html.erb +0 -5
- data/app/components/better_ui/general/table/component.rb +0 -217
- data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tbody_component.rb +0 -30
- data/app/components/better_ui/general/table/td_component.html.erb +0 -3
- data/app/components/better_ui/general/table/td_component.rb +0 -44
- data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
- data/app/components/better_ui/general/table/th_component.html.erb +0 -6
- data/app/components/better_ui/general/table/th_component.rb +0 -51
- data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
- data/app/components/better_ui/general/table/thead_component.rb +0 -28
- data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tr_component.rb +0 -30
- data/app/components/better_ui/general/tabs/component.html.erb +0 -11
- data/app/components/better_ui/general/tabs/component.rb +0 -120
- data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
- data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
- data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
- data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
- data/app/components/better_ui/general/tag/component.html.erb +0 -3
- data/app/components/better_ui/general/tag/component.rb +0 -104
- data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
- data/app/components/better_ui/general/tooltip/component.rb +0 -239
- data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
- data/app/helpers/better_ui/application/components/card.rb +0 -11
- data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
- data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
- data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
- data/app/helpers/better_ui/application_helper.rb +0 -55
- data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/accordion.rb +0 -11
- data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
- data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
- data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
- data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
- data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
- data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
- data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
- data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -79
- data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -62
- data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
- data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
- data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
- data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
- data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
- data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
- data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
- data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -70
- data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
- data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
- data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
- data/app/helpers/better_ui/general/components/modal.rb +0 -11
- data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
- data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
- data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
- data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
- data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
- data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
- data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
- data/app/views/layouts/better_ui/application.html.erb +0 -17
- data/lib/better_ui/railtie.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 317837f4f80e12e6ab860a7a134e9f17e01f5db2d86f5b178a4c9a2bc9588f3a
|
|
4
|
+
data.tar.gz: 8815e3b40a461070b9cb178ee1a7e1e8abaccbf6cea7366ab5c079db174429f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0fb96fb9537391b7448ffde247cd8d9ae4916dac0cfcd17c4efe912b061dfd05986368ebe6563549c58ce0909e9a509474ac885e136d133214f806437925726d
|
|
7
|
+
data.tar.gz: de95bf54dcd6fa022f5afa5c0867d65b7a78e8f24cab637aa7cf098f0bf01f5cabdac5e6c7b36ba1aba14833682b17174e1d229a4d428f5646d92ee876ad42f4
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,301 +1,319 @@
|
|
|
1
|
-
# BetterUI
|
|
1
|
+
# BetterUI 🎨
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/better_ui)
|
|
4
|
+
[](LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
- 📖 **Documentazione Interattiva**: Preview Lookbook integrate per tutti i componenti
|
|
7
|
-
- 🔧 **Altamente Personalizzabile**: Opzioni di configurazione flessibili per ogni componente
|
|
8
|
-
- 🚀 **Production Ready**: Componenti testati che seguono le best practices
|
|
9
|
-
- 📱 **Responsive**: Tutti i componenti sono mobile-first e responsive
|
|
10
|
-
- ♿ **Accessibile**: Costruiti pensando all'accessibilità
|
|
6
|
+
> Elegant, consistent, and easily integrable UI components for your Rails applications
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
BetterUI is a Rails gem that provides reusable UI components with built-in documentation. Designed to be lightweight, customizable, and easy to use, it helps you build beautiful and consistent interfaces without JavaScript.
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
## ✨ Key Features
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
- **Pure Design** - Elegant, fully CSS UI components, no JavaScript
|
|
13
|
+
- **Easy Integration** - Mountable Rails engine that integrates seamlessly with your app
|
|
14
|
+
- **Built-in Documentation** - View examples and documentation directly in your browser
|
|
15
|
+
- **Highly Customizable** - Easily adapt the style to your brand
|
|
16
|
+
- **Modular Components** - Use only what you need
|
|
17
|
+
- **Component Previews** - View and interact with components using Lookbook
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
- **26 Componenti**: Libreria completa organizzata per scopo
|
|
20
|
-
- **Sistema Input Unificato**: Componenti input supportano 14+ tipi (text, email, password, number, date, time, etc.)
|
|
21
|
-
- **Documentazione Interattiva**: Integrazione Lookbook con preview live
|
|
22
|
-
- **Sistema Helper**: Helper Rails-friendly con integrazione form builder
|
|
23
|
-
- **Tematizzazione Consistente**: 9 temi standard (default, white, red, rose, orange, green, blue, yellow, violet)
|
|
24
|
-
- **Dimensionamento Flessibile**: 3 dimensioni standard (small, medium, large) con 5 opzioni border radius
|
|
25
|
-
- **Accessibilità**: Componenti progettati seguendo le best practices di accessibilità
|
|
19
|
+
## 📦 Available Components
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
| Component | Description |
|
|
22
|
+
|------------|-------------|
|
|
23
|
+
| **Button** | Styled buttons with primary, secondary, success, danger variants |
|
|
24
|
+
| **Alert** | Informational, success, warning, and error messages |
|
|
25
|
+
| **Card** | Flexible containers with header, body, and footer |
|
|
26
|
+
| **Modal** | Modal dialog windows |
|
|
27
|
+
| **Tabs** | Tab navigation |
|
|
28
|
+
| **Navbar** | Responsive navigation bar with dropdown menu support |
|
|
29
|
+
| **Sidebar** | Side menu with hierarchical navigation support |
|
|
30
|
+
| **Toast** | Temporary notifications with timer and animations |
|
|
31
|
+
| **Header** | Page headers with title, subtitle, breadcrumb, and actions |
|
|
32
|
+
| **Badge** | Labels with support for icons, colors, and outline variants |
|
|
33
|
+
| **Spinner** | Loading indicators with various themes and sizes |
|
|
34
|
+
| **Avatar** | User avatars with support for images, initials, and online status |
|
|
35
|
+
| **Form Elements** | Styled input fields (coming soon) |
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
## 🚀 Installation
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
gem "better_ui"
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Per lo sviluppo con documentazione Lookbook:
|
|
39
|
+
Add this line to your application's Gemfile:
|
|
36
40
|
|
|
37
41
|
```ruby
|
|
38
|
-
gem
|
|
39
|
-
gem "lookbook", group: :development
|
|
42
|
+
gem 'better_ui', '~> 0.1.0'
|
|
40
43
|
```
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
And then execute:
|
|
43
46
|
|
|
44
47
|
```bash
|
|
45
48
|
$ bundle install
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
##
|
|
51
|
+
## ⚙️ Configuration
|
|
49
52
|
|
|
50
|
-
###
|
|
53
|
+
### Mount the Engine
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
Add this to your `config/routes.rb` file:
|
|
53
56
|
|
|
54
57
|
```ruby
|
|
55
58
|
Rails.application.routes.draw do
|
|
56
|
-
mount BetterUi::Engine =>
|
|
57
|
-
|
|
59
|
+
mount BetterUi::Engine => '/better_ui'
|
|
60
|
+
|
|
61
|
+
# ... your other routes
|
|
58
62
|
end
|
|
59
63
|
```
|
|
60
64
|
|
|
61
|
-
###
|
|
65
|
+
### Include the Assets
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```ruby
|
|
66
|
-
Rails.application.routes.draw do
|
|
67
|
-
# Monta Lookbook solo in development
|
|
68
|
-
mount Lookbook::Engine => "/lookbook" if Rails.env.development?
|
|
67
|
+
In `app/assets/stylesheets/application.css`:
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
```css
|
|
70
|
+
/*
|
|
71
|
+
*= require better_ui/application
|
|
72
|
+
*/
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### 3. Includi Tailwind CSS
|
|
77
|
-
|
|
78
|
-
Assicurati che la tua applicazione includa Tailwind CSS, dato che i componenti BetterUI si basano sulle classi Tailwind. Se non hai Tailwind CSS installato, segui la [guida ufficiale di installazione Tailwind CSS](https://tailwindcss.com/docs/guides/ruby-on-rails).
|
|
75
|
+
## 🎮 Usage
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
I componenti Better UI possono essere utilizzati in due modi: istanziazione diretta o metodi helper.
|
|
83
|
-
|
|
84
|
-
### Metodi Helper (Raccomandato)
|
|
77
|
+
Once installed, you can start using the components:
|
|
85
78
|
|
|
86
79
|
```erb
|
|
87
|
-
<%#
|
|
88
|
-
<%=
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
) %>
|
|
80
|
+
<%# Button %>
|
|
81
|
+
<%= better_ui_button("Save", type: "primary") %>
|
|
82
|
+
|
|
83
|
+
<%# Alert %>
|
|
84
|
+
<%= better_ui_alert("Operation completed", type: "success") %>
|
|
85
|
+
|
|
86
|
+
<%# Card %>
|
|
87
|
+
<%= better_ui_card do %>
|
|
88
|
+
<%= better_ui_card_header("Card Title") %>
|
|
89
|
+
<%= better_ui_card_body do %>
|
|
90
|
+
<p>Card content...</p>
|
|
91
|
+
<% end %>
|
|
92
|
+
<% end %>
|
|
96
93
|
|
|
97
|
-
<%#
|
|
98
|
-
<%=
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
<%# Header with breadcrumb %>
|
|
95
|
+
<%= render BetterUi::Application::HeaderComponent.new(
|
|
96
|
+
title: "Dashboard",
|
|
97
|
+
subtitle: "Manage everything from here",
|
|
98
|
+
breadcrumbs: [
|
|
99
|
+
{ text: "Home", url: "/" },
|
|
100
|
+
{ text: "Dashboard" }
|
|
101
|
+
],
|
|
102
|
+
actions: [
|
|
103
|
+
{ content: button_html("New", "primary") }
|
|
104
|
+
]
|
|
103
105
|
) %>
|
|
106
|
+
```
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
<%= bui_card(title: 'Profilo Utente', theme: :white) do %>
|
|
107
|
-
<p>Contenuto informazioni utente qui</p>
|
|
108
|
-
<% end %>
|
|
108
|
+
Visit `/better_ui` in your application to see the complete documentation and examples.
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
<%= form_with model: @user do |form| %>
|
|
112
|
-
<%= bui_input_text(name: 'name', form: form, required: true) %>
|
|
113
|
-
<%= bui_input_text(name: 'email', type: :email, form: form) %>
|
|
114
|
-
<%= bui_button('Salva', type: :submit, theme: :blue) %>
|
|
115
|
-
<% end %>
|
|
116
|
-
```
|
|
110
|
+
### The Header Component
|
|
117
111
|
|
|
118
|
-
|
|
112
|
+
The Header component is designed to create complete page headers with numerous features:
|
|
119
113
|
|
|
120
114
|
```erb
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
115
|
+
<%= render BetterUi::Application::HeaderComponent.new(
|
|
116
|
+
title: {
|
|
117
|
+
text: "Settings",
|
|
118
|
+
icon: "settings"
|
|
119
|
+
},
|
|
120
|
+
subtitle: "Configure system preferences",
|
|
121
|
+
breadcrumbs: [
|
|
122
|
+
{ text: "Home", url: "/" },
|
|
123
|
+
{ text: "Admin", url: "/admin" },
|
|
124
|
+
{ text: "Settings" }
|
|
125
|
+
],
|
|
126
|
+
variant: :modern,
|
|
127
|
+
fixed: :top,
|
|
128
|
+
show_breadcrumbs: true,
|
|
129
|
+
actions: [
|
|
130
|
+
{ content: button_html("Save", "primary") },
|
|
131
|
+
{ content: button_html("Cancel", "secondary") }
|
|
132
|
+
]
|
|
134
133
|
) %>
|
|
135
134
|
```
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
The component supports:
|
|
137
|
+
- Title with optional integrated icon
|
|
138
|
+
- Descriptive subtitle
|
|
139
|
+
- Complete breadcrumbs with navigation links
|
|
140
|
+
- Contextual actions (buttons, menus, etc.)
|
|
141
|
+
- Style variants: modern, light, dark, primary, transparent
|
|
142
|
+
- Fixed positioning (top or bottom)
|
|
143
|
+
- Breadcrumb visibility control
|
|
138
144
|
|
|
139
|
-
|
|
145
|
+
### Component Previews with Lookbook
|
|
140
146
|
|
|
141
|
-
|
|
142
|
-
- **3 Dimensioni Standard**: small, medium, large
|
|
143
|
-
- **5 Opzioni Border Radius**: none, small, medium, large, full
|
|
147
|
+
BetterUI integrates [Lookbook](https://github.com/allmarkedup/lookbook) to preview UI components:
|
|
144
148
|
|
|
145
|
-
|
|
149
|
+
1. Access `/better_ui/lookbook` in your application to view the component catalog
|
|
150
|
+
2. Explore available variants and configurations for each component
|
|
151
|
+
3. View source code and generated markup
|
|
152
|
+
4. Interact with components in real-time
|
|
146
153
|
|
|
147
|
-
|
|
154
|
+
Lookbook is only available in development and test environments.
|
|
148
155
|
|
|
149
|
-
|
|
150
|
-
# Le costanti del componente definiscono le opzioni di styling
|
|
151
|
-
BUTTON_THEME_CLASSES = {
|
|
152
|
-
default: 'bg-gray-100 text-gray-900 hover:bg-gray-200',
|
|
153
|
-
blue: 'bg-blue-600 text-white hover:bg-blue-700',
|
|
154
|
-
green: 'bg-green-600 text-white hover:bg-green-700'
|
|
155
|
-
}.freeze
|
|
156
|
-
|
|
157
|
-
BUTTON_SIZE_CLASSES = {
|
|
158
|
-
small: 'px-3 py-1.5 text-sm',
|
|
159
|
-
medium: 'px-4 py-2 text-base',
|
|
160
|
-
large: 'px-6 py-3 text-lg'
|
|
161
|
-
}.freeze
|
|
162
|
-
```
|
|
156
|
+
## 🎨 Customization
|
|
163
157
|
|
|
164
|
-
|
|
158
|
+
### Generate a Custom Stylesheet
|
|
165
159
|
|
|
166
|
-
|
|
160
|
+
BetterUI includes a generator to create a base stylesheet for customizing components:
|
|
167
161
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
162
|
+
```bash
|
|
163
|
+
# Generate a stylesheet with the default "custom" prefix
|
|
164
|
+
rails generate better_ui:stylesheet
|
|
171
165
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- **Sidebar**: Navigazione laterale collassabile
|
|
166
|
+
# Generate a stylesheet with a custom prefix
|
|
167
|
+
rails generate better_ui:stylesheet --prefix=my_theme
|
|
168
|
+
```
|
|
176
169
|
|
|
177
|
-
|
|
170
|
+
This will create:
|
|
171
|
+
1. A main SCSS file with imports for all components
|
|
172
|
+
2. Individual SCSS files for each component in the `app/assets/stylesheets/components/` directory
|
|
173
|
+
3. Special `*_overrides.scss` files for each component that allow you to override styles without modifying the original files
|
|
178
174
|
|
|
179
|
-
|
|
175
|
+
### Component Overrides System ✨
|
|
180
176
|
|
|
181
|
-
|
|
177
|
+
One of BetterUI's most powerful features is the automatic generation of override files:
|
|
182
178
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
- **Spinner**: Animazioni di caricamento
|
|
188
|
-
- **Tooltip**: Overlay di aiuto contestuale e informazioni
|
|
179
|
+
```bash
|
|
180
|
+
# Generate override files for all components
|
|
181
|
+
rails generate better_ui:stylesheet
|
|
182
|
+
```
|
|
189
183
|
|
|
190
|
-
|
|
184
|
+
This creates special `*_overrides.scss` files that:
|
|
185
|
+
- Contain empty classes matching the original component files
|
|
186
|
+
- Allow for clean customization without modifying the original styles
|
|
187
|
+
- Support both standard and nested SCSS class structures
|
|
188
|
+
- Include helpful comments for easier modification
|
|
189
|
+
|
|
190
|
+
Example override file structure:
|
|
191
|
+
```scss
|
|
192
|
+
/* ==============================
|
|
193
|
+
* Button Component Overrides
|
|
194
|
+
* ==============================
|
|
195
|
+
* This file contains empty classes to override default styles.
|
|
196
|
+
* Add your customizations here.
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
.bui-button-primary {
|
|
200
|
+
// Override styles for .bui-button-primary here
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.bui-button-secondary {
|
|
204
|
+
// Override styles for .bui-button-secondary here
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Nested class overrides
|
|
208
|
+
.bui-button-with-icon {
|
|
209
|
+
.bui-icon {
|
|
210
|
+
// Override nested styles here
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
191
214
|
|
|
192
|
-
|
|
193
|
-
- **Divider**: Separatori di contenuto visivi
|
|
194
|
-
- **Heading**: Intestazioni con tipografia consistente
|
|
195
|
-
- **Icon**: Sistema icone SVG con libreria estesa
|
|
196
|
-
- **Link**: Elementi anchor potenziati con supporto theme
|
|
197
|
-
- **Panel**: Sezioni di contenuto organizzate
|
|
198
|
-
- **Table**: Tabelle dati con sorting e funzionalità responsive
|
|
199
|
-
- **Tag**: Elementi di categorizzazione ed etichettatura
|
|
215
|
+
### Use the Initializer
|
|
200
216
|
|
|
201
|
-
|
|
217
|
+
Create a `config/initializers/better_ui.rb` file:
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- **Textarea**: Input testo multi-riga
|
|
219
|
+
```ruby
|
|
220
|
+
BetterUi.configure do |config|
|
|
221
|
+
config.button_defaults = {
|
|
222
|
+
class: 'rounded-lg text-sm'
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
config.alert_defaults = {
|
|
226
|
+
dismissible: true
|
|
227
|
+
}
|
|
228
|
+
end
|
|
229
|
+
```
|
|
215
230
|
|
|
216
|
-
###
|
|
231
|
+
### Customize Styles
|
|
217
232
|
|
|
218
|
-
|
|
233
|
+
Override CSS styles in your stylesheet:
|
|
219
234
|
|
|
220
|
-
|
|
235
|
+
```css
|
|
236
|
+
.better-ui-button-primary {
|
|
237
|
+
background-color: #8b5cf6; /* Custom purple */
|
|
238
|
+
border-color: #8b5cf6;
|
|
239
|
+
}
|
|
240
|
+
```
|
|
221
241
|
|
|
222
|
-
|
|
242
|
+
## 🛠 Development
|
|
223
243
|
|
|
224
|
-
|
|
225
|
-
2. **Estendere componenti**: Crea i tuoi componenti che ereditano da BetterUI
|
|
226
|
-
3. **Personalizzazione theme**: Modifica la configurazione Tailwind per tematizzazione consistente
|
|
244
|
+
BetterUI uses an integrated dummy app for development and testing. Here's how to get started:
|
|
227
245
|
|
|
228
|
-
|
|
229
|
-
<!-- Aggiungi classi personalizzate -->
|
|
230
|
-
<%= render BetterUi::General::Button::Component.new(
|
|
231
|
-
label: "Button Personalizzato",
|
|
232
|
-
classes: "my-custom-class hover:scale-105"
|
|
233
|
-
) %>
|
|
234
|
-
```
|
|
246
|
+
### Initial Setup
|
|
235
247
|
|
|
236
|
-
|
|
248
|
+
```bash
|
|
249
|
+
# Clone the repository
|
|
250
|
+
git clone https://github.com/alessiobussolari/better_ui.git
|
|
251
|
+
cd better_ui
|
|
237
252
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
4. **Estensioni Componenti**: Estendi componenti esistenti o crea i tuoi seguendo i pattern stabiliti
|
|
253
|
+
# Install dependencies
|
|
254
|
+
bin/setup
|
|
255
|
+
```
|
|
242
256
|
|
|
243
|
-
|
|
257
|
+
### Start the Test Application
|
|
244
258
|
|
|
245
|
-
|
|
259
|
+
To see components in action and work on documentation:
|
|
246
260
|
|
|
247
261
|
```bash
|
|
248
|
-
|
|
262
|
+
# Start the test server
|
|
263
|
+
cd test/dummy
|
|
264
|
+
bin/rails server
|
|
265
|
+
|
|
266
|
+
# Or from the main directory
|
|
267
|
+
bin/rails server -b 0.0.0.0
|
|
249
268
|
```
|
|
250
269
|
|
|
251
|
-
|
|
270
|
+
Visit `http://localhost:3000/better_ui` in your browser to see the documentation and test the components.
|
|
252
271
|
|
|
253
|
-
|
|
272
|
+
### Development Flow
|
|
254
273
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
274
|
+
1. **Create a branch**: `git checkout -b feature/new-component`
|
|
275
|
+
2. **Implement the component**: Add helpers in `app/helpers/better_ui/application_helper.rb`
|
|
276
|
+
3. **Add CSS**: Insert styles in `app/assets/stylesheets/better_ui/application.css`
|
|
277
|
+
4. **Document**: Create Markdown files in `docs/components/`
|
|
278
|
+
5. **Test**: Verify in the dummy app that everything works correctly
|
|
279
|
+
6. **Run tests**: `rake test`
|
|
258
280
|
|
|
259
|
-
|
|
281
|
+
### Build and Release
|
|
260
282
|
|
|
261
|
-
|
|
262
|
-
2. Crea il tuo branch feature (`git checkout -b feature/componente-fantastico`)
|
|
263
|
-
3. Aggiungi il tuo componente con test e preview Lookbook
|
|
264
|
-
4. Committa le tue modifiche (`git commit -am 'Aggiungi componente fantastico'`)
|
|
265
|
-
5. Pusha al branch (`git push origin feature/componente-fantastico`)
|
|
266
|
-
6. Crea una Pull Request
|
|
283
|
+
To build the gem locally:
|
|
267
284
|
|
|
268
|
-
|
|
285
|
+
```bash
|
|
286
|
+
bundle exec rake build
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
To install the development version:
|
|
269
290
|
|
|
270
291
|
```bash
|
|
271
|
-
|
|
272
|
-
cd better_ui
|
|
273
|
-
bundle install
|
|
274
|
-
cd test/dummy
|
|
275
|
-
bundle exec rails server
|
|
292
|
+
bundle exec rake install
|
|
276
293
|
```
|
|
277
294
|
|
|
278
|
-
|
|
295
|
+
## 🤝 Contributing
|
|
279
296
|
|
|
280
|
-
|
|
297
|
+
Contributions are welcome and appreciated! Here's how you can help:
|
|
281
298
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
-
|
|
286
|
-
|
|
287
|
-
|
|
299
|
+
1. **Fork** the repository on GitHub
|
|
300
|
+
2. **Clone** your fork: `git clone https://github.com/YOUR-USERNAME/better_ui.git`
|
|
301
|
+
3. **Create** a branch for your feature: `git checkout -b feature/amazing-improvement`
|
|
302
|
+
4. **Commit** your changes: `git commit -am 'Add an amazing feature'`
|
|
303
|
+
5. **Push** to the branch: `git push origin feature/amazing-improvement`
|
|
304
|
+
6. Submit a **Pull Request**
|
|
288
305
|
|
|
289
|
-
|
|
306
|
+
### Guidelines
|
|
290
307
|
|
|
291
|
-
|
|
308
|
+
- Follow the existing code style
|
|
309
|
+
- Write tests for new features
|
|
310
|
+
- Update documentation
|
|
311
|
+
- Create components that work without JavaScript
|
|
292
312
|
|
|
293
|
-
##
|
|
313
|
+
## 📄 License
|
|
294
314
|
|
|
295
|
-
|
|
296
|
-
- 🐛 [Issue Tracker](https://github.com/alessiobussolari/better_ui/issues)
|
|
297
|
-
- 💬 [Discussioni](https://github.com/alessiobussolari/better_ui/discussions)
|
|
315
|
+
BetterUI is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
298
316
|
|
|
299
317
|
---
|
|
300
318
|
|
|
301
|
-
|
|
319
|
+
Made with ❤️ by [Alessio Bussolari](https://github.com/alessiobussolari)
|