Merge pull request #15 from ayoayco/feat/add-library-link-on-address-bar
feat: add library link on to address bar
This commit is contained in:
commit
edaec363c8
3 changed files with 19 additions and 8 deletions
|
@ -27,9 +27,15 @@ const form = new FormGroup([
|
||||||
value: "Get cozy!",
|
value: "Get cozy!",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<a class="repo-link" href="https://github.com/ayoayco/cozy"
|
<nav>
|
||||||
>Star on GitHub</a
|
<a href="/"
|
||||||
|
>📚 Library</a
|
||||||
>
|
>
|
||||||
|
•
|
||||||
|
<a target="_blank" href="https://github.com/ayoayco/cozy"
|
||||||
|
>⭐️ GitHub</a
|
||||||
|
>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style is:inline>
|
<style is:inline>
|
||||||
|
@ -56,8 +62,10 @@ const form = new FormGroup([
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
a.repo-link {
|
nav {
|
||||||
font-size: small;
|
margin: 0.5em 0;
|
||||||
|
}
|
||||||
|
nav a {
|
||||||
color: brown;
|
color: brown;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -18,7 +18,6 @@ const { title } = Astro.props;
|
||||||
<body>
|
<body>
|
||||||
<slot />
|
<slot />
|
||||||
<div id="main-content">
|
<div id="main-content">
|
||||||
<a href="/">Home</a>
|
|
||||||
<div id="post-wrapper">
|
<div id="post-wrapper">
|
||||||
<slot name="post" />
|
<slot name="post" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import Library from "../components/Library.astro";
|
||||||
|
|
||||||
const params = Astro.url.searchParams;
|
const params = Astro.url.searchParams;
|
||||||
const url = params.get('url') || '';
|
const url = params.get('url') || '';
|
||||||
let article: ArticleData;
|
let article: ArticleData | null;
|
||||||
let skipSave;
|
let skipSave;
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
|
@ -16,7 +16,11 @@ const error = {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
article = await extract(url) || error;
|
article = await extract(url);
|
||||||
|
if (!article ) {
|
||||||
|
article = error;
|
||||||
|
skipSave = true;
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
article = error;
|
article = error;
|
||||||
skipSave = true;
|
skipSave = true;
|
||||||
|
@ -34,5 +38,5 @@ if (url === '') {
|
||||||
<Layout title={url !== "" ? article?.title : "Your modern-day reading assistant"}>
|
<Layout title={url !== "" ? article?.title : "Your modern-day reading assistant"}>
|
||||||
<AddressBar url={url} />
|
<AddressBar url={url} />
|
||||||
<Post slot="post" article={article} />
|
<Post slot="post" article={article} />
|
||||||
<Library skipSave={!article || skipSave} slot="library" postDivSelector="#post" />
|
<Library skipSave={skipSave} slot="library" postDivSelector="#post" />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
Loading…
Reference in a new issue