feat(pastes): add page to view pastes

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2021-08-13 05:47:13 +05:30
parent d818c7033a
commit c6c54347a7
No known key found for this signature in database
GPG Key ID: ED5C54FBBB920E51
6 changed files with 23 additions and 2 deletions

View File

@ -6,7 +6,6 @@
* { * {
font-family: 'JetBrains Mono', monospace; font-family: 'JetBrains Mono', monospace;
background-color: #1a1a1a;
color: white; color: white;
} }
@ -14,6 +13,14 @@ a:hover {
@apply text-amber; @apply text-amber;
} }
html, body {
width: 100%;
height: 100%;
}
header {
background-color: #1a1a1a
}
@import "./phoenix.css"; @import "./phoenix.css";

View File

@ -10,6 +10,7 @@ module.exports = {
extend: { extend: {
colors: { colors: {
amber: '#ff9800', amber: '#ff9800',
'light-grey': '#212121',
}, },
}, },
}, },

View File

@ -1,7 +1,15 @@
defmodule KetbinWeb.PageController do defmodule KetbinWeb.PageController do
use KetbinWeb, :controller use KetbinWeb, :controller
alias Ketbin.Pastes
alias Ketbin.Pastes.Paste
def index(conn, _params) do def index(conn, _params) do
render(conn, "index.html") render(conn, "index.html")
end end
def show(conn, %{"id" => id}) do
paste = Pastes.get_paste!(id)
render(conn, "show.html", paste: paste)
end
end end

View File

@ -20,6 +20,7 @@ defmodule KetbinWeb.Router do
pipe_through :browser pipe_through :browser
get "/", PageController, :index get "/", PageController, :index
get "/:id", PageController, :show
end end
# Other scopes may use custom stacks. # Other scopes may use custom stacks.

View File

@ -31,7 +31,7 @@
</nav> </nav>
</header> </header>
<main role="main"> <main class="w-full h-full bg-light-grey" role="main">
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p> <p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p> <p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<%= @inner_content %> <%= @inner_content %>

View File

@ -0,0 +1,4 @@
<pre class="py-6">
<code><%= @paste.content %></code>
</pre>