Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add readme for mods #398

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import tailwind from '@astrojs/tailwind';
import react from '@astrojs/react';

import sitemap from '@astrojs/sitemap';
import markdownIntegration from '@astropub/md';

// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), react(), sitemap({
filter: (page) => !page.includes('mods/'),
})],
}), markdownIntegration()],
site: 'https://zen-browser.app',
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"@astrojs/react": "^4.1.2",
"@astrojs/rss": "^4.0.10",
"@astrojs/sitemap": "^3.2.1",
"@astrojs/tailwind": "^5.1.2",
"@astropub/md": "^1.0.0",
"@astrojs/tailwind": "^5.1.4",
"@fontsource/bricolage-grotesque": "^5.1.0",
"@fortawesome/fontawesome-svg-core": "^6.7.1",
Expand All @@ -41,6 +43,7 @@
"typescript": "^5.6.3"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.15",
"wrangler": "^3.94.0"
}
}
52 changes: 52 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions src/components/ReadmeComponent.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
import { markdown } from '@astropub/md'
import { ExternalLink } from 'lucide-astro'

interface Props {
url: string
id: string
}

const { url, id } = Astro.props

const readme = await fetch(url).then((res) => res.text())
const readmeLink = `https://github.com/zen-browser/theme-store/tree/main/themes/${id}`
const html = await markdown(readme)
---

<section id="readme-wrapper" class="rounded-xl bg-coral/10 p-2">
<h2
class="flex w-full flex-wrap items-baseline justify-start gap-1 pb-2 text-2xl"
>
Readme
<a href={readmeLink} target="_blank">
{' '}
<ExternalLink
class="aspect-square h-4 text-dark opacity-40 hover:opacity-100 transition-all ease-linear duration-100"
/>{' '}
</a>

</h2>
<div
id="markdown-content"
class="prose-lg border-t border-dark pt-2 p-2 prose-a:underline prose-li:list-disc"
>
<Fragment set:html={html} class:list={'readme-text'} />
</div>
</section>
12 changes: 6 additions & 6 deletions src/pages/mods/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import Title from '../../components/Title.astro';
import Description from '../../components/Description.astro';
import Button from '../../components/Button.astro';
import BackButton from '../../components/BackButton.astro';

import { Info } from 'lucide-astro';
import ReadmeComponent from '../../components/ReadmeComponent.astro';

import { ArrowRight, Info } from 'lucide-astro';

export async function getStaticPaths() {
Expand All @@ -16,8 +20,6 @@ export async function getStaticPaths() {
}));
}

// https://github.com/TeaClientMC/Website/blob/7faacc9f8b2c79c74f711d413b155c84faafc00d/src/pages/news/%5B...slug%5D.astro

const mod = Astro.props;

const dates = {
Expand Down Expand Up @@ -79,10 +81,8 @@ const dates = {
</Button>
</div>
</div>
<!-- TODO: Readme markdown
<div class="h-[1px] opacity-80 bg-dark w-full"></div>
-->
<ReadmeComponent url={mod.readme} id={mod.id}/>
</div>
<div>
</main>
</Layout>
</Layout>
4 changes: 3 additions & 1 deletion tailwind.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ export default {
},
},
},
plugins: [],
plugins: [
require('@tailwindcss/typography'),
],
}
Loading