defmodule LivebookWeb.EnvVarsComponent do use LivebookWeb, :live_component @impl true def render(assigns) do assigns = assigns |> assign_new(:target, fn -> nil end) |> assign_new(:edit_label, fn -> "Edit" end) ~H"""
<%= for env_var <- @env_vars do %>
<.env_var_info socket={@socket} env_var={env_var} edit_label={@edit_label} target={@target} />
<% end %>
<%= live_patch("Add environment variable", to: @add_env_var_path, id: "add-env-var", class: "button-base button-blue" ) %>
""" end defp env_var_info(assigns) do ~H"""
<.labeled_text label="Name"> <%= @env_var.name %>
<.menu id={"env-var-#{@env_var.name}-menu"}> <:toggle> <:content>
""" end end