Skip to content

Commit 66458b6

Browse files
Convert 0.0.1 basic components to eex templates for mix task (#52)
* Delete MishkaChelekomComponents import from all component * VIP - Add nil value for the props user does not send * Add list string in task output instead of nil * Add color and variant condition of accordion eex * Add accordion space and rounded options inside its eex conditions * VIP - Add none menu rounded conditions inside eex * Add size conditions inside accordion eex * Add padding conditions inside accordion eex * Add web_module to component task * Add variant inside alert component eex * Add color conditions for alert eex file * Add entries eex template of avatar * Add type conditions for avatar eex component * Add size, rounded and color conditions of avatar eex file * Add space condition of avatar's eex file * Add entry eex file of badge * Add variant condition of badge eex file * Add rounded, color and variant conditions of badge eex file * Add size condition of badge eex * Add banner entry eex file * Add padding and size conditions for banner eex file * Add space and rounded of banner eex file * Add variant condition pf banner eex file * Add color condition of banner eex file * Add entry file of blockquote eex * Add space condition of blockquote eex file * Add variant, padding and rounded of blockquote eex file * Add color condition of blockquote eex file * Add entry file of breadcrumb eex * Add size and color of breadcrumb eex file * Add entry file of button eex file * Add type of button eex file * Add varian condition of button eex file * Add color condition of button eex * Add rounded and size of button component eex file * Add entry file of card eex * Add all cli conditions of card eex file * Add entry eex file of carousel * Add eex condition of carousel * Add enrty eex file of chat * Add eex conditions of chat * Add entry eex file if checkbox * Add eex conditions of chekbox_field * Add entry eex file of color_field * Add color_field eex conditions * add entry eex file of date_time_field * Add eex condtion of date_time_field * Add entry eex file of device * Add color eex file of device * Add entry eex file of divider * Add divider eex file conditions * Add entry eex file of drawer * Add variant eex condition of drawer * Add color and variant eex file of drawer * Add eex entry file of dropdown * remove extra argument from dropdown size function (#53) * Add eex conditions of dropdown * Add eex entry file of email_field * Add size space and rounded conditions of email_field eex * Add email field eex variant condition * Add color condition of email_field eex * Add entry eex file of fieldset * Add size padding and round with variant of fieldset eex * Add eex color of fieldset * Add entry eex file of file_field * Add color variant round and space eex file of file_field * Add color condition of file_field eex * Add footer eex conditions * Add color condition of footer eex * Add eex of form wrapper * Add eex variant of form_wrapper * Add color condition of form_wrapper eex * Add entry eex file of gallery * Add eex file of gallery * Add eex file of image * Add eex file of indicator * Add eex file of input_field * Add entry eex file of jumbotron * Add some conditions of jumbotron eex file * Add variant condition of jumbotron eex file * Add color condition of jumbotron eex file * Add entry eex file of keyboard * Add variant and size, round in keybord eex file * Add color of keyboard eex * Add entry eex file of list component * Add some conditions of list eex file * Add color eex condition of list * Add entry eex file of mega_menu * Add variant, size and round space of mega menu eex file * Add color condition of mega menu eex * Add eex entry file of menu * Add size and space of menu eex file * Add entry eex file of modal * Add size condition eex of modal * Add variant of modal eex file * Add modal color eex file * Add entry eex file of native_select * Add variant size, space of native_select * Add color of native_select eex * Add entry eex file of navbar * Add size and round space of navbar eex file * Add variant of navbar eex * Add color of navbar eex * Add entry eex of number_field * Add size and round, space olf number_field * Add variant of number_field eex * Add color of number_field eex * Add entry eex file of overlay * Add color and size of overlay eex * Add entry eex file of pagination * VIP - change border function name of pagination eex * Add size and round of pagination eex * Add variant and size of pagination * Add color of pagination eex * Add entry eex file of password_field * Add size and space of password_field eex * Add variant of password_field eex * Add color of password_field eex * Add entry file of popover * Add type of popover eex * Add space and size of popover eex file * Add color of popover eex * Add entry eex file of progress * Add progress color for eex file * Add entry eex file of radio_field * Add color of radio_field eex * Add entry eex file of range_field * Add color of range_field * Add rating eex file entry level * Add size and color of rating eex * Add entry eex file of search_field * Add size, round and space of search_field eex * Add variant of search_field eex * Add color of search_field eex * Add entry eex file of sidebar * Add color of sidebar eex * Add entry eex of skeleton * Add color of skeleton eex * Update skeleton.exs * Add entry file of speed_dial eex * Add variant, size round space of speed_dial eex * Add color of speed_dial eex * Add entry eex file of spinner * Add size of spinner eex * Add extra type for spinner eex * Add color of spinner eex * Add entry eex file of stepper * Add type of stepper eex * Add color of stepper eex * Add entry eex file of table * Add size padding round of table eex * Add color of table eex * Add entry eex of table_content * Add type of table_content * Add size round space of table_content * Add color of table_content eex * Add entry eex of tabs * Add variant * Add color of tabs eex * Add eex file of tel_field * Add color of tel_field * Add entry eex file of text_field * Add space and size of text_field eex * Add color of text_field eex * Add entry eex file of textarea_field * Add eex conditions of textarea_field * Add entry eex file timeline * Add color of timeline eex * Add entry eex file of toast * Add color of toast eex * Add entry eex of toggle_field * Add color and size of toggle_field * Add entry eex of tooltip * Add color of tooltip eex * Add entry eex file of typography * Add color and size of typography eex * Add type of typography eex * Add url_field entry eex file * Add size of url_field eex * Add color of url_field eex * Add video eex * Add some conditions of video eex * vip --------- Co-authored-by: Mona Aghili <[email protected]>
1 parent 9ad12c2 commit 66458b6

File tree

173 files changed

+44240
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+44240
-92
lines changed

.formatter.exs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22
import_deps: [:ecto, :ecto_sql, :phoenix],
33
subdirectories: ["priv/*/migrations"],
44
plugins: [Phoenix.LiveView.HTMLFormatter],
5-
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"]
5+
inputs: [
6+
"*.{heex,ex,exs}",
7+
"{config,lib,test}/**/*.{heex,ex,exs}",
8+
"priv/*/seeds.exs",
9+
"priv/templates/components/**/*.{exs}"
10+
]
611
]

lib/mishka_chelekom_web/components/chelekom/accordion.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ defmodule MishkaChelekom.Accordion do
2121
accordion items, enhancing the visual appeal and usability of the component.
2222
"""
2323
use Phoenix.Component
24-
import MishkaChelekomComponents
2524
alias Phoenix.LiveView.JS
2625

2726
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
@@ -1553,4 +1552,19 @@ defmodule MishkaChelekom.Accordion do
15531552

15541553
Map.drop(rest, all_rest)
15551554
end
1555+
1556+
attr :name, :string, required: true, doc: "Specifies the name of the element"
1557+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
1558+
1559+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
1560+
~H"""
1561+
<span class={[@name] ++ @class} />
1562+
"""
1563+
end
1564+
1565+
defp icon(%{name: "hero-" <> _} = assigns) do
1566+
~H"""
1567+
<span class={[@name, @class]} />
1568+
"""
1569+
end
15561570
end

lib/mishka_chelekom_web/components/chelekom/alert.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ defmodule MishkaChelekom.Alert do
2626
flexibility in rendering custom content within alerts.
2727
"""
2828
use Phoenix.Component
29-
import MishkaChelekomComponents
3029
import MishkaChelekomWeb.Gettext
3130
alias Phoenix.LiveView.JS
3231

@@ -597,4 +596,19 @@ defmodule MishkaChelekom.Alert do
597596
"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"}
598597
)
599598
end
599+
600+
attr :name, :string, required: true, doc: "Specifies the name of the element"
601+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
602+
603+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
604+
~H"""
605+
<span class={[@name] ++ @class} />
606+
"""
607+
end
608+
609+
defp icon(%{name: "hero-" <> _} = assigns) do
610+
~H"""
611+
<span class={[@name, @class]} />
612+
"""
613+
end
600614
end

lib/mishka_chelekom_web/components/chelekom/avatar.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ defmodule MishkaChelekom.Avatar do
2020
"""
2121

2222
use Phoenix.Component
23-
import MishkaChelekomComponents
2423

2524
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
2625
@colors [
@@ -546,4 +545,19 @@ defmodule MishkaChelekom.Avatar do
546545
"relative inline-flex items-center justify-center p-0.5 [&.border-avatar:has(.indicator)]:box-content"
547546
]
548547
end
548+
549+
attr :name, :string, required: true, doc: "Specifies the name of the element"
550+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
551+
552+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
553+
~H"""
554+
<span class={[@name] ++ @class} />
555+
"""
556+
end
557+
558+
defp icon(%{name: "hero-" <> _} = assigns) do
559+
~H"""
560+
<span class={[@name, @class]} />
561+
"""
562+
end
549563
end

lib/mishka_chelekom_web/components/chelekom/badge.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ defmodule MishkaChelekom.Badge do
1616

1717
use Phoenix.Component
1818
alias Phoenix.LiveView.JS
19-
import MishkaChelekomComponents
2019

2120
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
2221
@colors [
@@ -673,4 +672,19 @@ defmodule MishkaChelekom.Badge do
673672
"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"}
674673
)
675674
end
675+
676+
attr :name, :string, required: true, doc: "Specifies the name of the element"
677+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
678+
679+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
680+
~H"""
681+
<span class={[@name] ++ @class} />
682+
"""
683+
end
684+
685+
defp icon(%{name: "hero-" <> _} = assigns) do
686+
~H"""
687+
<span class={[@name, @class]} />
688+
"""
689+
end
676690
end

lib/mishka_chelekom_web/components/chelekom/banner.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ defmodule MishkaChelekom.Banner do
2828

2929
use Phoenix.Component
3030
alias Phoenix.LiveView.JS
31-
import MishkaChelekomComponents
3231
import MishkaChelekomWeb.Gettext
3332

3433
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
@@ -648,4 +647,19 @@ defmodule MishkaChelekom.Banner do
648647
"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"}
649648
)
650649
end
650+
651+
attr :name, :string, required: true, doc: "Specifies the name of the element"
652+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
653+
654+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
655+
~H"""
656+
<span class={[@name] ++ @class} />
657+
"""
658+
end
659+
660+
defp icon(%{name: "hero-" <> _} = assigns) do
661+
~H"""
662+
<span class={[@name, @class]} />
663+
"""
664+
end
651665
end

lib/mishka_chelekom_web/components/chelekom/blockquote.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ defmodule MishkaChelekom.Blockquote do
2323
"""
2424

2525
use Phoenix.Component
26-
import MishkaChelekomComponents
2726

2827
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
2928
@colors [
@@ -543,4 +542,19 @@ defmodule MishkaChelekom.Blockquote do
543542
defp border_position(%{right_border: true}), do: "right"
544543
defp border_position(%{full_border: true}), do: "full"
545544
defp border_position(_), do: "left"
545+
546+
attr :name, :string, required: true, doc: "Specifies the name of the element"
547+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
548+
549+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
550+
~H"""
551+
<span class={[@name] ++ @class} />
552+
"""
553+
end
554+
555+
defp icon(%{name: "hero-" <> _} = assigns) do
556+
~H"""
557+
<span class={[@name, @class]} />
558+
"""
559+
end
546560
end

lib/mishka_chelekom_web/components/chelekom/breadcrumb.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ defmodule MishkaChelekom.Breadcrumb do
1414
behavior and appearance.
1515
"""
1616
use Phoenix.Component
17-
import MishkaChelekomComponents
1817

1918
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
2019
@colors [
@@ -213,4 +212,19 @@ defmodule MishkaChelekom.Breadcrumb do
213212
"flex items-center transition-all ease-in-ou duration-100 group"
214213
]
215214
end
215+
216+
attr :name, :string, required: true, doc: "Specifies the name of the element"
217+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
218+
219+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
220+
~H"""
221+
<span class={[@name] ++ @class} />
222+
"""
223+
end
224+
225+
defp icon(%{name: "hero-" <> _} = assigns) do
226+
~H"""
227+
<span class={[@name, @class]} />
228+
"""
229+
end
216230
end

lib/mishka_chelekom_web/components/chelekom/button.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ defmodule MishkaChelekom.Button do
2323
"""
2424

2525
use Phoenix.Component
26-
import MishkaChelekomComponents
2726

2827
@sizes ["extra_small", "small", "medium", "large", "extra_large"]
2928
@variants [
@@ -1139,4 +1138,19 @@ defmodule MishkaChelekom.Button do
11391138

11401139
Map.drop(rest, all_rest)
11411140
end
1141+
1142+
attr :name, :string, required: true, doc: "Specifies the name of the element"
1143+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
1144+
1145+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
1146+
~H"""
1147+
<span class={[@name] ++ @class} />
1148+
"""
1149+
end
1150+
1151+
defp icon(%{name: "hero-" <> _} = assigns) do
1152+
~H"""
1153+
<span class={[@name, @class]} />
1154+
"""
1155+
end
11421156
end

lib/mishka_chelekom_web/components/chelekom/card.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ defmodule MishkaChelekom.Card do
2626
"""
2727

2828
use Phoenix.Component
29-
import MishkaChelekomComponents
3029

3130
@sizes [
3231
"extra_small",
@@ -684,4 +683,19 @@ defmodule MishkaChelekom.Card do
684683
defp color_variant("transparent", "dark") do
685684
"bg-transparent text-[#1E1E1E] border-transparent"
686685
end
686+
687+
attr :name, :string, required: true, doc: "Specifies the name of the element"
688+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
689+
690+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
691+
~H"""
692+
<span class={[@name] ++ @class} />
693+
"""
694+
end
695+
696+
defp icon(%{name: "hero-" <> _} = assigns) do
697+
~H"""
698+
<span class={[@name, @class]} />
699+
"""
700+
end
687701
end

lib/mishka_chelekom_web/components/chelekom/carousel.ex

+15-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ defmodule MishkaChelekom.Carousel do
2121
"""
2222

2323
use Phoenix.Component
24-
import MishkaChelekomComponents
2524
alias Phoenix.LiveView.JS
2625

2726
@doc """
@@ -527,4 +526,19 @@ defmodule MishkaChelekom.Carousel do
527526
|> JS.remove_class("active-indicator", to: ".carousel-indicator")
528527
end)
529528
end
529+
530+
attr :name, :string, required: true, doc: "Specifies the name of the element"
531+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
532+
533+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
534+
~H"""
535+
<span class={[@name] ++ @class} />
536+
"""
537+
end
538+
539+
defp icon(%{name: "hero-" <> _} = assigns) do
540+
~H"""
541+
<span class={[@name, @class]} />
542+
"""
543+
end
530544
end

lib/mishka_chelekom_web/components/chelekom/chekbox_field.ex

+33-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ defmodule MishkaChelekom.CheckboxField do
1515
"""
1616

1717
use Phoenix.Component
18-
import MishkaChelekomComponents
1918

2019
@doc """
2120
The `checkbox_field` component is used to create customizable checkbox input elements with various
@@ -390,4 +389,37 @@ defmodule MishkaChelekom.CheckboxField do
390389
"focus-within:[&_.checkbox-field-wrapper_.checkbox-input]:ring-[#050404]"
391390
]
392391
end
392+
393+
attr :name, :string, required: true, doc: "Specifies the name of the element"
394+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
395+
396+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
397+
~H"""
398+
<span class={[@name] ++ @class} />
399+
"""
400+
end
401+
402+
defp icon(%{name: "hero-" <> _} = assigns) do
403+
~H"""
404+
<span class={[@name, @class]} />
405+
"""
406+
end
407+
408+
defp translate_error({msg, opts}) do
409+
# When using gettext, we typically pass the strings we want
410+
# to translate as a static argument:
411+
#
412+
# # Translate the number of files with plural rules
413+
# dngettext("errors", "1 file", "%{count} files", count)
414+
#
415+
# However the error messages in our forms and APIs are generated
416+
# dynamically, so we need to translate them by calling Gettext
417+
# with our gettext backend as first argument. Translations are
418+
# available in the errors.po file (as we use the "errors" domain).
419+
if count = opts[:count] do
420+
Gettext.dngettext(MishkaChelekomWeb.Gettext, "errors", msg, msg, count, opts)
421+
else
422+
Gettext.dgettext(MishkaChelekomWeb.Gettext, "errors", msg, opts)
423+
end
424+
end
393425
end

lib/mishka_chelekom_web/components/chelekom/color_field.ex

+33-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ defmodule MishkaChelekom.ColorField do
1313
"""
1414

1515
use Phoenix.Component
16-
import MishkaChelekomComponents
1716

1817
@doc """
1918
The `color_field` component is used to create a customizable color input field with various
@@ -279,4 +278,37 @@ defmodule MishkaChelekom.ColorField do
279278
"[&_.color-field-wrapper_.color-input]:border-[#050404]"
280279
]
281280
end
281+
282+
defp translate_error({msg, opts}) do
283+
# When using gettext, we typically pass the strings we want
284+
# to translate as a static argument:
285+
#
286+
# # Translate the number of files with plural rules
287+
# dngettext("errors", "1 file", "%{count} files", count)
288+
#
289+
# However the error messages in our forms and APIs are generated
290+
# dynamically, so we need to translate them by calling Gettext
291+
# with our gettext backend as first argument. Translations are
292+
# available in the errors.po file (as we use the "errors" domain).
293+
if count = opts[:count] do
294+
Gettext.dngettext(MishkaChelekomWeb.Gettext, "errors", msg, msg, count, opts)
295+
else
296+
Gettext.dgettext(MishkaChelekomWeb.Gettext, "errors", msg, opts)
297+
end
298+
end
299+
300+
attr :name, :string, required: true, doc: "Specifies the name of the element"
301+
attr :class, :any, default: nil, doc: "Custom CSS class for additional styling"
302+
303+
defp icon(%{name: "hero-" <> _, class: class} = assigns) when is_list(class) do
304+
~H"""
305+
<span class={[@name] ++ @class} />
306+
"""
307+
end
308+
309+
defp icon(%{name: "hero-" <> _} = assigns) do
310+
~H"""
311+
<span class={[@name, @class]} />
312+
"""
313+
end
282314
end

0 commit comments

Comments
 (0)