Skip to content

Commit 27880ba

Browse files
committed
refactor: simplify class assignment in CoreComponents
- Replaced inline class array with a `classes/1` function for cleaner and more maintainable code. - This change enhances readability and consistency in the component's styling logic.
1 parent 35250c2 commit 27880ba

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/algora_web/components/core_components.ex

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,17 @@ defmodule AlgoraWeb.CoreComponents do
791791
name={@name}
792792
id={@id || @name}
793793
value={Phoenix.HTML.Form.normalize_value(@type, @value)}
794-
class={[
795-
"py-[7px] px-[11px] block w-full rounded-lg border-input bg-background",
796-
"text-foreground focus:outline-none focus:ring-1 sm:text-sm sm:leading-6",
797-
"border-input focus:border-ring focus:ring-ring",
798-
@errors != [] &&
799-
"border-destructive placeholder-destructive-foreground/50 focus:border-destructive focus:ring-destructive/10",
800-
@icon && "pl-10",
801-
@class
802-
]}
794+
class={
795+
classes([
796+
"py-[7px] px-[11px] block w-full rounded-lg border-input bg-background",
797+
"text-foreground focus:outline-none focus:ring-1 sm:text-sm sm:leading-6",
798+
"border-input focus:border-ring focus:ring-ring",
799+
@errors != [] &&
800+
"border-destructive placeholder-destructive-foreground/50 focus:border-destructive focus:ring-destructive/10",
801+
@icon && "pl-10",
802+
@class
803+
])
804+
}
803805
autocomplete="off"
804806
{@rest}
805807
/>

0 commit comments

Comments
 (0)