Skip to content

Commit 08d03db

Browse files
committed
fix css
1 parent afe0e40 commit 08d03db

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

lib/live_debugger/components/tree.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule LiveDebugger.Components.Tree do
2222

2323
def tree(assigns) do
2424
~H"""
25-
<.card class="h-full max-h-max opacity-90" variant="outline">
25+
<.card class="h-max opacity-90" variant="outline">
2626
<.h4 class="text-swm-blue pt-2 pl-2">{@title}</.h4>
2727
<.card_content class="px-1 pb-4 pt-0">
2828
<.tree_node

lib/live_debugger/live_components/detail_view.ex

+22-18
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ defmodule LiveDebugger.LiveComponents.DetailView do
66

77
alias LiveDebugger.Services.TreeNode
88
alias Phoenix.LiveView.AsyncResult
9-
alias PetalComponents.Alert
109
alias LiveDebugger.Services.ChannelStateScraper
1110

1211
use LiveDebuggerWeb, :live_component
@@ -30,20 +29,20 @@ defmodule LiveDebugger.LiveComponents.DetailView do
3029
@impl true
3130
def render(assigns) do
3231
~H"""
33-
<div class="flex flex-col w-full h-screen max-h-screen gap-4 p-2 overflow-x-hidden overflow-y-auto md:overflow-y-hidden">
32+
<div class="flex flex-col w-full h-screen max-h-screen p-2 overflow-x-hidden overflow-y-auto md:overflow-y-hidden">
3433
<.async_result :let={node} assign={@node}>
3534
<:loading>
3635
<div class="w-full flex items-center justify-center">
3736
<.spinner size="md" />
3837
</div>
3938
</:loading>
4039
<:failed :let={reason}>
41-
<Alert.alert color="danger">
40+
<.alert color="danger">
4241
Failed to fetch node details: {inspect(reason)}
43-
</Alert.alert>
42+
</.alert>
4443
</:failed>
45-
<div class="grid grid-cols-1 gap-2 md:grid-cols-2 md:h-full">
46-
<div class="flex flex-col gap-4 max">
44+
<div class="grid grid-cols-1 md:grid-cols-2 md:h-full">
45+
<div class="flex flex-col max md:border-r-2 border-swm-blue md:overflow-y-hidden">
4746
<.info_card node={node} node_type={@node_type.result} />
4847
<.assigns_card assigns={node.assigns} />
4948
</div>
@@ -59,13 +58,13 @@ defmodule LiveDebugger.LiveComponents.DetailView do
5958

6059
defp info_card(assigns) do
6160
~H"""
62-
<.basic_card title={title(@node_type)}>
61+
<.section title={title(@node_type)} class="border-b-2 border-swm-blue">
6362
<div class=" flex flex-col gap-1">
6463
<.info_row name={id_type(@node_type)} value={TreeNode.parsed_id(@node)} />
6564
<.info_row name="Module" value={inspect(@node.module)} />
6665
<.info_row name="HTML ID" value={@node.id} />
6766
</div>
68-
</.basic_card>
67+
</.section>
6968
"""
7069
end
7170

@@ -75,7 +74,7 @@ defmodule LiveDebugger.LiveComponents.DetailView do
7574
defp info_row(assigns) do
7675
~H"""
7776
<div class="flex gap-1 overflow-x-hidden">
78-
<div class="font-bold text-swm-blue">
77+
<div class="font-bold w-20 text-swm-blue">
7978
{@name}
8079
</div>
8180
<div class="break-all">
@@ -95,24 +94,29 @@ defmodule LiveDebugger.LiveComponents.DetailView do
9594

9695
defp assigns_card(assigns) do
9796
~H"""
98-
<.basic_card title="Assigns">
99-
<div class="w-full whitespace-pre-wrap break-words overflow-y-auto">
100-
{inspect(@assigns, pretty: true)}
97+
<.section title="Assigns" class="border-b-2 md:border-b-0 border-swm-blue h-max overflow-y-hidden">
98+
<div class="w-full flex flex-col gap-1 overflow-y-auto">
99+
<%= for {key, value} <- @assigns do %>
100+
<div class="overflow-x-hidden whitespace-pre-wrap break-words flex flex gap-2 min-h-max">
101+
<div class="text-swm-blue font-bold">{key}</div>
102+
<div class="whitespace-pre-wrap">{inspect(value)}</div>
103+
</div>
104+
<% end %>
101105
</div>
102-
</.basic_card>
106+
</.section>
103107
"""
104108
end
105109

106110
defp events_card(assigns) do
107111
~H"""
108-
<.basic_card title="Events" class="h-full">
112+
<.section title="Events" class="h-full md:overflow-y-auto">
109113
<.live_component
110114
id="event-list"
111115
module={LiveDebugger.LiveComponents.EventsList}
112116
debugged_node_id={@pid}
113117
socket_id={@socket_id}
114118
/>
115-
</.basic_card>
119+
</.section>
116120
"""
117121
end
118122

@@ -121,13 +125,13 @@ defmodule LiveDebugger.LiveComponents.DetailView do
121125

122126
slot(:inner_block)
123127

124-
defp basic_card(assigns) do
128+
defp section(assigns) do
125129
~H"""
126130
<div class={[
127-
"flex flex-col gap-4 p-4 bg-swm-blue text-white rounded-xl shadow-xl",
131+
"flex flex-col p-4",
128132
@class
129133
]}>
130-
<.h3 class="text-white">{@title}</.h3>
134+
<.h3 class="text-swm-blue">{@title}</.h3>
131135
<div class="flex h-full overflow-y-auto overflow-x-hidden rounded-md bg-white opacity-90 text-black p-2">
132136
{render_slot(@inner_block)}
133137
</div>

lib/live_debugger/live_components/sidebar.ex

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ defmodule LiveDebugger.LiveComponents.Sidebar do
88
alias Phoenix.LiveView.AsyncResult
99
alias LiveDebugger.Components.Tree
1010
alias LiveDebugger.Services.ChannelStateScraper
11-
alias PetalComponents.Alert
1211

1312
require Logger
1413

@@ -33,7 +32,7 @@ defmodule LiveDebugger.LiveComponents.Sidebar do
3332
@impl true
3433
def render(assigns) do
3534
~H"""
36-
<div class="w-[20vw] min-w-60 h-screen bg-swm-blue flex flex-col gap-1 pt-4 p-2 pr-3 rounded-r-xl">
35+
<div class="w-[20vw] min-w-60 min-h-max h-screen bg-swm-blue flex flex-col gap-1 pt-4 p-2 pr-3 rounded-r-xl">
3736
<.h3 class="text-white">Live Debugger</.h3>
3837
<.separate_bar />
3938
<.basic_info pid={@pid} socket_id={@socket_id} />
@@ -75,7 +74,7 @@ defmodule LiveDebugger.LiveComponents.Sidebar do
7574
<div class="w-full flex justify-center mt-5"><.spinner class="text-white" /></div>
7675
</:loading>
7776
<:failed :let={_error}>
78-
<Alert.alert color="danger">Couldn't load a tree</Alert.alert>
77+
<.alert color="danger">Couldn't load a tree</.alert>
7978
</:failed>
8079
<Tree.tree
8180
:if={tree}

0 commit comments

Comments
 (0)