petal_components icon indicating copy to clipboard operation
petal_components copied to clipboard

Mix task to "eject" components

Open mplatts opened this issue 2 years ago • 4 comments

Sometimes you want to use a component as a starting point and modify it heavily.

Example: I want to modify the <.card> component.

mix petal_components:eject card

And it generates a copy of the card component into my live folder.

mplatts avatar Jun 08 '22 05:06 mplatts

I'll implement it in the coming months - but if someone wants to contribute just comment here and go for it

mplatts avatar Jun 08 '22 05:06 mplatts

I'll implement it in the coming months - but if someone wants to contribute just comment here and go for it

maybe use @callback so user could override what he want from component and keep all helpers.

mohammedzeglam-pg avatar Oct 28 '22 03:10 mohammedzeglam-pg

defmodule Ex do
  @callback h(item) :: item when item: var

  def h(x), do: IO.inspect(x)
end
defmodule E do
  @behaviour Ex
  def h(x), do: IO.inspect(x)
end
E.h("go")
Ex.h("sas")

mohammedzeglam-pg avatar Oct 28 '22 22:10 mohammedzeglam-pg

Hey, yeah if you can get this working that'd be great. maybe do it for one component and see if it's viable?

mplatts avatar Oct 28 '22 22:10 mplatts