mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-22 07:01:09 +00:00
various improvements
This commit is contained in:
parent
af80819eca
commit
9be6abf776
6 changed files with 72 additions and 57 deletions
|
@ -13,10 +13,11 @@ pub fn EditorView(
|
|||
let (show_preview, set_show_preview) = create_signal(false);
|
||||
|
||||
view! {
|
||||
<div class="my-4">
|
||||
<textarea
|
||||
value=content
|
||||
placeholder="Article text..."
|
||||
class="textarea textarea-bordered textarea-primary min-w-full"
|
||||
class="textarea textarea-primary min-w-full min-h-80 resize-none"
|
||||
on:input=move |evt| {
|
||||
let val = event_target_value(&evt);
|
||||
set_preview.set(render_markdown(&val));
|
||||
|
@ -26,17 +27,21 @@ pub fn EditorView(
|
|||
>
|
||||
{content.get()}
|
||||
</textarea>
|
||||
<button class="btn" on:click=move |_| { set_show_preview.update(|s| *s = !*s) }>
|
||||
<button
|
||||
class="btn btn-secondary my-4"
|
||||
on:click=move |_| { set_show_preview.update(|s| *s = !*s) }
|
||||
>
|
||||
Preview
|
||||
</button>
|
||||
<Show when=move || { show_preview.get() }>
|
||||
<div id="preview" inner_html=move || preview.get()></div>
|
||||
</Show>
|
||||
<div>
|
||||
<a href="https://commonmark.org/help/" target="blank_">
|
||||
<a class="link link-secondary" href="https://commonmark.org/help/" target="blank_">
|
||||
Markdown
|
||||
</a>
|
||||
" formatting is supported"
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,13 +50,14 @@ pub fn CreateArticle() -> impl IntoView {
|
|||
});
|
||||
|
||||
view! {
|
||||
<h1>Create new Article</h1>
|
||||
<h1 class="text-4xl font-bold font-serif my-4">Create new Article</h1>
|
||||
<Show
|
||||
when=move || create_response.get().is_some()
|
||||
fallback=move || {
|
||||
view! {
|
||||
<div class="item-view">
|
||||
<input
|
||||
class="input input-primary w-full"
|
||||
type="text"
|
||||
required
|
||||
placeholder="Title"
|
||||
|
@ -77,7 +78,9 @@ pub fn CreateArticle() -> impl IntoView {
|
|||
})
|
||||
}}
|
||||
|
||||
<div class="flex flex-row">
|
||||
<input
|
||||
class="input input-primary grow mr-2"
|
||||
type="text"
|
||||
placeholder="Edit summary"
|
||||
on:keyup=move |ev| {
|
||||
|
@ -87,14 +90,17 @@ pub fn CreateArticle() -> impl IntoView {
|
|||
/>
|
||||
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
prop:disabled=move || button_is_disabled.get()
|
||||
on:click=move |_| {
|
||||
submit_action.dispatch((title.get(), content.get(), summary.get()))
|
||||
submit_action
|
||||
.dispatch((title.get(), content.get(), summary.get()))
|
||||
}
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
>
|
||||
|
|
|
@ -136,13 +136,11 @@ pub fn EditArticle() -> impl IntoView {
|
|||
.map(|err| {
|
||||
view! { <p style="color:red;">{err}</p> }
|
||||
})
|
||||
}}
|
||||
<EditorView textarea_ref content set_content />
|
||||
|
||||
<div class="inputs">
|
||||
}} <EditorView textarea_ref content set_content />
|
||||
<div class="flex flex-row mr-2">
|
||||
<input
|
||||
type="text"
|
||||
class="input input-secondary"
|
||||
class="input input-secondary grow"
|
||||
placeholder="Edit summary"
|
||||
value=summary.get_untracked()
|
||||
on:keyup=move |ev| {
|
||||
|
|
|
@ -35,11 +35,16 @@ pub fn ArticleHistory() -> impl IntoView {
|
|||
edit.edit.hash.0,
|
||||
);
|
||||
view! {
|
||||
<li>
|
||||
{render_date_time(edit.edit.created)}": "
|
||||
<a class="link link-primary" href=path>
|
||||
<li class="card card-compact bg-base-100 card-bordered m-2 rounded-s">
|
||||
<div class="card-body">
|
||||
<a class="link link-primary text-lg w-full" href=path>
|
||||
{edit.edit.summary}
|
||||
</a> " by " {user_link(&edit.creator)}
|
||||
</a>
|
||||
<p>
|
||||
{render_date_time(edit.edit.created)}" by "
|
||||
{user_link(&edit.creator)}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
})
|
||||
|
|
|
@ -33,11 +33,12 @@ pub fn EditDiff() -> impl IntoView {
|
|||
render_date_time(edit.edit.created),
|
||||
);
|
||||
view! {
|
||||
<div class="item-view">
|
||||
<h1>{article.article.title.replace('_', " ")}</h1>
|
||||
<h2>{label}</h2>
|
||||
<h2 class="text-xl font-bold font-serif my-2">{label}</h2>
|
||||
<p>"by " {user_link(&edit.creator)}</p>
|
||||
<pre>{edit.edit.diff.clone()}</pre>
|
||||
<div class="bg-gray-200 p-2 rounded my-2">
|
||||
<pre>
|
||||
<code>{edit.edit.diff.clone()}</code>
|
||||
</pre>
|
||||
</div>
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue