-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refac: move article editor in separate component
- Loading branch information
Showing
2 changed files
with
64 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts"> | ||
import { | ||
Card, | ||
Tabs, | ||
TabItem, | ||
Heading, | ||
Label, | ||
Textarea, | ||
} from "flowbite-svelte"; | ||
import Markdown from "$lib/Markdown.svelte"; | ||
import References from "$lib/References.svelte"; | ||
export let refs = ""; | ||
export let content = ""; | ||
</script> | ||
|
||
<Card | ||
class="max-w-full" | ||
style="height: 600px; overflow-y: scroll; padding: 0; padding-top: 4px; padding-left: 4px;" | ||
> | ||
<Tabs contentClass="bg-none p-5" style="underline"> | ||
<TabItem title="article content" open> | ||
<div> | ||
<Label for="content" class="block mb-2" | ||
>Protein Article (Markdown)</Label | ||
> | ||
<Textarea | ||
id="content" | ||
placeholder="Enter markdown..." | ||
rows={12} | ||
bind:value={content} | ||
/> | ||
</div> | ||
|
||
<div class="mt-3"> | ||
<Label for="refs" class="block mb-2">References (BibTeX)</Label> | ||
<Textarea | ||
id="refs" | ||
placeholder="Enter bibtex with atleast an id, title, and author (optionally url and year)" | ||
rows={4} | ||
bind:value={refs} | ||
/> | ||
</div> | ||
</TabItem> | ||
<TabItem title="preview"> | ||
{#if content.length > 0 || refs.length > 0} | ||
<Card class="max-w-full"> | ||
<Heading tag="h4">Article</Heading> | ||
<Markdown text={content} /> | ||
</Card> | ||
|
||
<Card class="max-w-full mt-5"> | ||
<Heading tag="h4">References</Heading> | ||
<References bibtex={String.raw`${refs}`} /> | ||
</Card> | ||
{:else} | ||
No content to render/preview | ||
{/if} | ||
</TabItem> | ||
</Tabs> | ||
</Card> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters