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

Add default layout and move test environments to it #40

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a9d2742
Revert "Revert "Add CSS reset""
tatarianBarbarian Sep 19, 2023
2f46d49
Revert "Revert "Pass default layout if not specified and generate nav…
tatarianBarbarian Sep 19, 2023
6acf55b
Revert "Revert "Fix frontmatter""
tatarianBarbarian Sep 19, 2023
9a0236b
Revert "Revert "Add default layout without theming""
tatarianBarbarian Sep 19, 2023
9fc0b7b
Revert "Revert "Move website-nanostors to default layout""
tatarianBarbarian Sep 19, 2023
deb5992
Revert "Revert "Edit website-nanostores index page to use default lay…
tatarianBarbarian Sep 19, 2023
3ec9de6
Revert "Revert "Move website-nanostores-multiple-ep to default layout""
tatarianBarbarian Sep 19, 2023
63ad048
Remove `outline:none` for buttons and links in style resets
tatarianBarbarian Sep 19, 2023
b78cb59
Create navigation file on docs building stage for the case when user …
tatarianBarbarian Sep 19, 2023
7e120f5
Test environments doesn't need a nav json now
tatarianBarbarian Sep 19, 2023
6cb6df5
Merge branch 'main' into 35-default-layouts
tatarianBarbarian Sep 20, 2023
2372827
Add test environment with semi-custom layout
tatarianBarbarian Sep 20, 2023
0dfcf67
Use prefixed class names
tatarianBarbarian Sep 20, 2023
247a180
Add test environment for case when user reuses css only
tatarianBarbarian Sep 20, 2023
eb42802
Do not clean generated pages directory
tatarianBarbarian Sep 21, 2023
43c804a
Remove frontmatter `layout` field if equals to `null`
tatarianBarbarian Sep 21, 2023
3f49144
Style default sidebar
tatarianBarbarian Sep 21, 2023
e468507
Add some styles to content
tatarianBarbarian Sep 21, 2023
bc28aa9
Add code styles
tatarianBarbarian Sep 21, 2023
b3759bc
Move sources to frontmatter
tatarianBarbarian Sep 21, 2023
c8b5fec
Fix sidebar
tatarianBarbarian Sep 21, 2023
f3e703c
Fix navigation scrolling
tatarianBarbarian Sep 21, 2023
732b129
Update astro
tatarianBarbarian Sep 21, 2023
14b90d8
Expand custom layout example
tatarianBarbarian Sep 22, 2023
9c5b591
Add index pages to `/docs/` sections of the test environments
tatarianBarbarian Sep 22, 2023
a94019a
Update readme
tatarianBarbarian Sep 22, 2023
38e0ab0
Add title and fix content width
tatarianBarbarian Sep 22, 2023
fa9adeb
Add margins to markdown
tatarianBarbarian Sep 22, 2023
2ea8b6c
Add border between navigation and content
tatarianBarbarian Sep 22, 2023
93995b5
Add style file to readme
tatarianBarbarian Sep 22, 2023
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
Prev Previous commit
Next Next commit
Add test environment for case when user reuses css only
  • Loading branch information
tatarianBarbarian committed Sep 20, 2023
commit 247a18002834c25180ca14f1862c42ddeb04e036
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ packages:
# Astro site for nanostores project (multiple entrypoints)
- 'test/website-nanostores-multiple-ep'
- 'test/website-semi-custom-layout'
- 'test/website-custom-layout'
15 changes: 15 additions & 0 deletions test/website-custom-layout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
pnpm-debug.log*


# environment variables
.env
.env.production
12 changes: 12 additions & 0 deletions test/website-custom-layout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This site is generated from `nanostores` codebase types.

## `nanstores` repo is needed

To make it work please make sure you have cloned [`nanostores`](https://github.com/nanostores/nanostores)
repo locally, and follow folder structure:

```
.
├── astro-typedoc
└── nanostores
```
28 changes: 28 additions & 0 deletions test/website-custom-layout/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineConfig } from 'astro/config'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'

import initAstroTypedoc from '../../index.js'

const __dirname = dirname(fileURLToPath(import.meta.url))

const astroTypedoc = await initAstroTypedoc({
baseUrl: '/docs/',
entryPoints: [{ path: resolve(__dirname, '../../../nanostores/index.d.ts') }],
tsconfig: resolve(__dirname, '../../../nanostores/tsconfig.json')
})

const project = await astroTypedoc.getReflections()

await astroTypedoc.generateDocs({
frontmatter: {
layout: resolve(__dirname, './src/components/DocLayout.astro')
},
outputFolder: 'src/pages/docs',
project
})

await astroTypedoc.generateNavigationJSON(project, resolve(__dirname, './src/'))

// https://astro.build/config
export default defineConfig({})
15 changes: 15 additions & 0 deletions test/website-custom-layout/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "website-semi-custom-layout",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"astro": "^3.1.1"
}
}
18 changes: 18 additions & 0 deletions test/website-custom-layout/src/components/DocLayout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
import SiteLayout from './SiteLayout.astro'
import '../../../../ui/styles/md/table.css'
---

<SiteLayout>
<main class="at-markdown">
<slot />
</main>
</SiteLayout>

<style>
:root {
--at-border-color: orange;
--at-table-link-bg: lightyellow;
--at-table-link-hover-bg: yellow;
}
</style>
22 changes: 22 additions & 0 deletions test/website-custom-layout/src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
---

<header class="header">
<a href="/">Site</a>
<a href="/docs/">API Docs</a>
</header>

<style>
.header {
padding: 12px 0;
border-bottom: 1px solid grey;
display: flex;
gap: 24px;
margin-bottom: 32px;
}

.header a {
color: black;
font-size: 18px;
}
</style>
4 changes: 4 additions & 0 deletions test/website-custom-layout/src/components/Navigation.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

<p>123</p>
13 changes: 13 additions & 0 deletions test/website-custom-layout/src/components/SiteLayout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
import Navigation from './Navigation.astro'
import Header from './Header.astro'
---

<head>
<title>Custom Layout</title>
</head>
<Header />
<div class="layout">
<Navigation />
<slot />
</div>
2 changes: 2 additions & 0 deletions test/website-custom-layout/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
12 changes: 12 additions & 0 deletions test/website-custom-layout/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
import SiteLayout from '../components/SiteLayout.astro'
---

<SiteLayout>
<h1>Hello there!</h1>
<p>
This is a absolutely custom Astro site, which reuses some CSS from
`astro-typedoc`
</p>
<a href="/docs/">Go to docs!</a>
</SiteLayout>
3 changes: 3 additions & 0 deletions test/website-custom-layout/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/base"
}
36 changes: 36 additions & 0 deletions ui/styles/md/table.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:root {
--at-border-color: lightgrey;
--at-table-link-bg: rgba(211, 211, 211, 0.7);
--at-table-link-hover-bg: rgba(211, 211, 211, 1);
}

.at-markdown table {
width: 100%;
margin-bottom: 16px;
border-collapse: collapse;
}

.at-markdown td,
.at-markdown th {
padding: 12px 0;
border-bottom: 1px solid var(--at-border-color);
}

.at-markdown table th + th,
.at-markdown table td + td {
padding-left: 51px;
}

.at-markdown table a {
text-decoration: none;
display: inline-block;
padding: 4px;
background: var(--at-table-link-bg);
transition: background 0.3s ease;
color: black;
border-radius: 4px;
}

.at-markdown table a:hover {
background: var(--at-table-link-hover-bg);
}