Skip to content

Commit b7ab274

Browse files
committed
style: enhance dropdown component and improve text truncation
- Added a class attribute to the dropdown for better styling control. - Implemented text truncation for user names and context names to improve layout consistency and prevent overflow in the UI.
1 parent 1ee67ec commit b7ab274

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

lib/algora_web/components/core_components.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ defmodule AlgoraWeb.CoreComponents do
210210

211211
def context_selector(assigns) do
212212
~H"""
213-
<.dropdown id="dashboard-dropdown">
213+
<.dropdown id="dashboard-dropdown" class={@class}>
214214
<:img src={@current_context.avatar_url} alt={@current_context.handle} />
215215
<:title>{@current_context.name}</:title>
216216
@@ -222,9 +222,9 @@ defmodule AlgoraWeb.CoreComponents do
222222
{Algora.Util.initials(@current_user.name)}
223223
</.avatar_fallback>
224224
</.avatar>
225-
<div>
226-
<div class="font-semibold">{@current_user.name}</div>
227-
<div class="text-sm text-gray-500">
225+
<div class="truncate">
226+
<div class="font-semibold truncate">{@current_user.name}</div>
227+
<div class="text-sm text-gray-500 truncate">
228228
Solver dashboard
229229
</div>
230230
</div>
@@ -238,9 +238,9 @@ defmodule AlgoraWeb.CoreComponents do
238238
{Algora.Util.initials(@current_user.name)}
239239
</.avatar_fallback>
240240
</.avatar>
241-
<div>
242-
<div class="font-semibold">{@current_user.name}</div>
243-
<div class="text-sm text-gray-500">
241+
<div class="truncate">
242+
<div class="font-semibold truncate">{@current_user.name}</div>
243+
<div class="text-sm text-gray-500 truncate">
244244
Bounty board
245245
</div>
246246
</div>
@@ -262,9 +262,9 @@ defmodule AlgoraWeb.CoreComponents do
262262
{Algora.Util.initials(ctx.name)}
263263
</.avatar_fallback>
264264
</.avatar>
265-
<div>
266-
<div class="font-semibold">{ctx.name}</div>
267-
<div :if={ctx.handle} class="text-sm text-gray-500">@{ctx.handle}</div>
265+
<div class="truncate">
266+
<div class="font-semibold truncate">{ctx.name}</div>
267+
<div :if={ctx.handle} class="text-sm text-gray-500 truncate">@{ctx.handle}</div>
268268
</div>
269269
</div>
270270
</:link>

lib/algora_web/components/layouts/user.html.heex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
current_user={@current_user}
257257
current_context={@current_context}
258258
all_contexts={@all_contexts}
259+
class="w-[12rem]"
259260
/>
260261
<% else %>
261262
<.link

0 commit comments

Comments
 (0)