Skip to content

Commit 9fb2063

Browse files
committed
fix lint
1 parent e7a4d99 commit 9fb2063

File tree

6 files changed

+79
-79
lines changed

6 files changed

+79
-79
lines changed

lib/ruby_ui/sidebar/collapsiable_sidebar.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@ def view_template(&)
2424

2525
def sidebar_attrs
2626
{
27-
class: 'group peer hidden text-sidebar-foreground md:block',
27+
class: "group peer hidden text-sidebar-foreground md:block",
2828
data: {
29-
state: @open ? 'expanded' : 'collapsed',
30-
collapsible: @open ? '' : @collapsible,
29+
state: @open ? "expanded" : "collapsed",
30+
collapsible: @open ? "" : @collapsible,
3131
variant: @variant,
3232
side: @side,
3333
collapsible_kind: @collapsible,
34-
ruby_ui__sidebar_target: 'sidebar'
34+
ruby_ui__sidebar_target: "sidebar"
3535
}
3636
}
3737
end
3838

3939
def gap_element_attrs
4040
{
4141
class: [
42-
'relative w-[--sidebar-width] bg-transparent transition-[width]',
43-
'duration-200 ease-linear',
44-
'group-data-[collapsible=offcanvas]:w-0',
45-
'group-data-[side=right]:rotate-180',
42+
"relative w-[--sidebar-width] bg-transparent transition-[width]",
43+
"duration-200 ease-linear",
44+
"group-data-[collapsible=offcanvas]:w-0",
45+
"group-data-[side=right]:rotate-180",
4646
variant_classes
4747
]
4848
}
@@ -51,8 +51,8 @@ def gap_element_attrs
5151
def content_wrapper_attrs
5252
{
5353
class: [
54-
'fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width]',
55-
'transition-[left,right,width] duration-200 ease-linear md:flex',
54+
"fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width]",
55+
"transition-[left,right,width] duration-200 ease-linear md:flex",
5656
content_wrapper_side_classes,
5757
content_wrapper_variant_classes
5858
]
@@ -62,37 +62,37 @@ def content_wrapper_attrs
6262
def content_attrs
6363
{
6464
class: [
65-
'flex h-full w-full flex-col bg-sidebar',
66-
'group-data-[variant=floating]:rounded-lg',
67-
'group-data-[variant=floating]:border',
68-
'group-data-[variant=floating]:border-sidebar-border',
69-
'group-data-[variant=floating]:shadow'
65+
"flex h-full w-full flex-col bg-sidebar",
66+
"group-data-[variant=floating]:rounded-lg",
67+
"group-data-[variant=floating]:border",
68+
"group-data-[variant=floating]:border-sidebar-border",
69+
"group-data-[variant=floating]:shadow"
7070
],
7171
data: {
72-
sidebar: 'sidebar'
72+
sidebar: "sidebar"
7373
}
7474
}
7575
end
7676

7777
def variant_classes
7878
if %i[floating inset].include?(@variant)
79-
'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
79+
"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
8080
else
81-
'group-data-[collapsible=icon]:w-[--sidebar-width-icon]'
81+
"group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
8282
end
8383
end
8484

8585
def content_wrapper_side_classes
86-
return 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]' if @side == :left
86+
return "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" if @side == :left
8787

88-
'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]'
88+
"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]"
8989
end
9090

9191
def content_wrapper_variant_classes
9292
if %i[floating inset].include?(@variant)
93-
'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
93+
"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
9494
else
95-
'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l'
95+
"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l"
9696
end
9797
end
9898
end

lib/ruby_ui/sidebar/mobile_sidebar.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module RubyUI
44
class MobileSidebar < Base
5-
SIDEBAR_WIDTH_MOBILE = '18rem'
5+
SIDEBAR_WIDTH_MOBILE = "18rem"
66

77
def initialize(side: :left, **attrs)
88
@side = side
@@ -13,20 +13,20 @@ def view_template(&)
1313
Sheet(**attrs) do
1414
SheetContent(
1515
side: @side,
16-
class: 'w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden',
16+
class: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
1717
style: {
1818
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
1919
},
2020
data: {
21-
sidebar: 'sidebar',
22-
mobile: 'true'
21+
sidebar: "sidebar",
22+
mobile: "true"
2323
}
2424
) do
25-
SheetHeader(class: 'sr-only') do
26-
SheetTitle { 'Sidebar' }
27-
SheetDescription { 'Displays the mobile sidebar.' }
25+
SheetHeader(class: "sr-only") do
26+
SheetTitle { "Sidebar" }
27+
SheetDescription { "Displays the mobile sidebar." }
2828
end
29-
div(class: 'flex h-full w-full flex-col', &)
29+
div(class: "flex h-full w-full flex-col", &)
3030
end
3131
end
3232
end
@@ -36,8 +36,8 @@ def view_template(&)
3636
def default_attrs
3737
{
3838
data: {
39-
ruby_ui__sidebar_target: 'mobileSidebar',
40-
action: 'ruby--ui-sidebar:open->ruby-ui--sheet#open:self'
39+
ruby_ui__sidebar_target: "mobileSidebar",
40+
action: "ruby--ui-sidebar:open->ruby-ui--sheet#open:self"
4141
}
4242
}
4343
end

lib/ruby_ui/sidebar/sidebar_rail.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ def view_template(&)
1111
def default_attrs
1212
{
1313
class: [
14-
'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all',
15-
'ease-linear after:absolute after:inset-y-0 after:left-1/2',
16-
'after:w-[2px] hover:after:bg-sidebar-border',
17-
'group-data-[side=left]:-right-4 group-data-[side=right]:left-0',
18-
'sm:flex [[data-side=left]_&]:cursor-w-resize',
19-
'[[data-side=right]_&]:cursor-e-resize',
20-
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize',
21-
'[[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
22-
'group-data-[collapsible=offcanvas]:translate-x-0',
23-
'group-data-[collapsible=offcanvas]:after:left-full',
24-
'group-data-[collapsible=offcanvas]:hover:bg-sidebar',
25-
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
26-
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2'
14+
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all",
15+
"ease-linear after:absolute after:inset-y-0 after:left-1/2",
16+
"after:w-[2px] hover:after:bg-sidebar-border",
17+
"group-data-[side=left]:-right-4 group-data-[side=right]:left-0",
18+
"sm:flex [[data-side=left]_&]:cursor-w-resize",
19+
"[[data-side=right]_&]:cursor-e-resize",
20+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize",
21+
"[[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
22+
"group-data-[collapsible=offcanvas]:translate-x-0",
23+
"group-data-[collapsible=offcanvas]:after:left-full",
24+
"group-data-[collapsible=offcanvas]:hover:bg-sidebar",
25+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
26+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2"
2727
],
2828
data: {
29-
sidebar: 'rail',
30-
tabindex: '-1',
31-
action: 'click->ruby-ui--sidebar#toggle'
29+
sidebar: "rail",
30+
tabindex: "-1",
31+
action: "click->ruby-ui--sidebar#toggle"
3232
}
3333
}
3434
end

lib/ruby_ui/sidebar/sidebar_trigger.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ class SidebarTrigger < Base
55
def view_template(&)
66
Button(variant: :ghost, size: :icon, **attrs) do
77
panel_left_icon
8-
span(class: 'sr-only') { 'Toggle Sidebar' }
8+
span(class: "sr-only") { "Toggle Sidebar" }
99
end
1010
end
1111

1212
private
1313

1414
def default_attrs
1515
{
16-
class: 'h-7 w-7 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
16+
class: "h-7 w-7 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
1717
data: {
18-
sidebar: 'trigger',
19-
action: 'click->ruby-ui--sidebar#toggle'
18+
sidebar: "trigger",
19+
action: "click->ruby-ui--sidebar#toggle"
2020
}
2121
}
2222
end
2323

2424
def panel_left_icon
2525
svg(
26-
xmlns: 'http://www.w3.org/2000/svg',
27-
width: '24',
28-
height: '24',
29-
viewBox: '0 0 24 24',
30-
fill: 'none',
31-
stroke: 'currentColor',
32-
stroke_width: '2',
33-
stroke_linecap: 'round',
34-
stroke_linejoin: 'round',
35-
class: 'lucide lucide-panel-left'
26+
xmlns: "http://www.w3.org/2000/svg",
27+
width: "24",
28+
height: "24",
29+
viewBox: "0 0 24 24",
30+
fill: "none",
31+
stroke: "currentColor",
32+
stroke_width: "2",
33+
stroke_linecap: "round",
34+
stroke_linejoin: "round",
35+
class: "lucide lucide-panel-left"
3636
) do |s|
37-
s.rect(width: '18', height: '18', x: '3', y: '3', rx: '2')
38-
s.path(d: 'M9 3v18')
37+
s.rect(width: "18", height: "18", x: "3", y: "3", rx: "2")
38+
s.path(d: "M9 3v18")
3939
end
4040
end
4141
end

lib/ruby_ui/sidebar/sidebar_wrapper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
module RubyUI
44
class SidebarWrapper < Base
5-
SIDEBAR_WIDTH = '16rem'
6-
SIDEBAR_WIDTH_ICON = '3rem'
5+
SIDEBAR_WIDTH = "16rem"
6+
SIDEBAR_WIDTH_ICON = "3rem"
77

88
def view_template(&)
99
div(**attrs, &)
@@ -13,10 +13,10 @@ def view_template(&)
1313

1414
def default_attrs
1515
{
16-
class: 'group/sidebar-wrapper [&:has([data-variant=inset])]:bg-sidebar flex min-h-svh w-full',
16+
class: "group/sidebar-wrapper [&:has([data-variant=inset])]:bg-sidebar flex min-h-svh w-full",
1717
style: "--sidebar-width: #{SIDEBAR_WIDTH}; --sidebar-width-icon: #{SIDEBAR_WIDTH_ICON};",
1818
data: {
19-
controller: 'ruby-ui--sidebar'
19+
controller: "ruby-ui--sidebar"
2020
}
2121
}
2222
end

test/ruby_ui/sidebar_test.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'test_helper'
3+
require "test_helper"
44

55
class RubyUI::SidebarTest < ComponentTest
66
def test_render_with_all_items
@@ -10,31 +10,31 @@ def test_render_with_all_items
1010
RubyUI.SidebarHeader do
1111
RubyUI.SidebarGroup do
1212
RubyUI.SidebarGroupContent do
13-
RubyUI.SidebarInput(id: 'search', placeholder: 'Search the docs')
13+
RubyUI.SidebarInput(id: "search", placeholder: "Search the docs")
1414
end
1515
end
1616
end
1717
RubyUI.SidebarContent do
1818
RubyUI.SidebarGroup do
19-
RubyUI.SidebarGroupLabel { 'Application' }
20-
RubyUI.SidebarGroupAction { 'Group Action' }
19+
RubyUI.SidebarGroupLabel { "Application" }
20+
RubyUI.SidebarGroupAction { "Group Action" }
2121
RubyUI.SidebarGroupContent do
2222
RubyUI.SidebarMenu do
2323
RubyUI.SidebarMenuItem do
2424
RubyUI.SidebarMenuSub do
2525
RubyUI.SidebarMenuSubItem do
26-
RubyUI.SidebarMenuSubButton(as: 'a', href: '#') { 'Sub Item 1' }
26+
RubyUI.SidebarMenuSubButton(as: "a", href: "#") { "Sub Item 1" }
2727
end
2828
end
2929
end
3030
RubyUI.SidebarMenuItem do
31-
RubyUI.SidebarMenuButton(as: 'a', href: '#') { 'Settings' }
32-
RubyUI.SidebarMenuAction { 'Settings' }
31+
RubyUI.SidebarMenuButton(as: "a", href: "#") { "Settings" }
32+
RubyUI.SidebarMenuAction { "Settings" }
3333
end
3434
RubyUI.SidebarMenuItem do
35-
RubyUI.SidebarMenuButton { 'Dashboard' }
36-
RubyUI.SidebarMenuAction { 'Dashboard' }
37-
RubyUI.SidebarMenuBadge { 'Dashboard Badge' }
35+
RubyUI.SidebarMenuButton { "Dashboard" }
36+
RubyUI.SidebarMenuAction { "Dashboard" }
37+
RubyUI.SidebarMenuBadge { "Dashboard Badge" }
3838
end
3939
RubyUI.SidebarMenuItem do
4040
RubyUI.SidebarMenuSkeleton()
@@ -43,7 +43,7 @@ def test_render_with_all_items
4343
end
4444
end
4545
end
46-
RubyUI.SidebarFooter { 'Footer' }
46+
RubyUI.SidebarFooter { "Footer" }
4747
RubyUI.SidebarRail()
4848
end
4949
RubyUI.SidebarInset do

0 commit comments

Comments
 (0)