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