Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BryceRussell committed Feb 24, 2024
0 parents commit 65576d8
Show file tree
Hide file tree
Showing 20 changed files with 3,281 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# My Astro Theme!

This is my awesome Astro theme created using [`astro-theme-provider`](https://github.com/BryceRussell/astro-theme-provider)!

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "theme-root",
"license": "MIT",
"private": true,
"scripts": {},
"devDependencies": {
"astro": "^4.4.4"
}
}
36 changes: 36 additions & 0 deletions package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# My Astro Theme!

This is my awesome Astro theme created using [`astro-theme-provider`](https://github.com/BryceRussell/astro-theme-provider)!

### Install

1. Create an empty Astro project:

```sh
npm create astro@latest mywebsite --template empty -y
```

2. Add the theme to your project:

```sh
npm run astro add my-theme
```

### Configure

```ts
import { defineConfig } from "astro/config";
import MyTheme from "my-theme";

export default defineConfig({
integrations: [
MyTheme({
config: {
title: "Hey!",
description: "This is my website!",
},
}),
],
});

```
Binary file added package/assets/houston.webp
Binary file not shown.
27 changes: 27 additions & 0 deletions package/components/Hero.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
interface Props {
title: string;
desc?: string | undefined;
}
const { title, desc } = Astro.props;
---

<div>
<h1>{title}</h1>
<p>{desc || "Where did the description go?"}</p>
</div>

<style>
div {
max-width: 75ch;
padding: 1rem;
text-align: center;
color: white;
}

h1 {
max-width: 15ch;
font-size: 3.5rem;
}
</style>
26 changes: 26 additions & 0 deletions package/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:root {
height: 100%;
background-color: #111;
}

body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
height: 100%;
gap: 1rem;
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
line-height: 1.5;
background-image: linear-gradient(#222222 0.7000000000000001px, transparent 0.7000000000000001px), linear-gradient(to right, #222222 0.7000000000000001px, #111 0.7000000000000001px);
background-size: 20px 20px;
}

img {
max-width: 250px;
width: 100%;
height: auto;
}
9 changes: 9 additions & 0 deletions package/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import defineTheme from "astro-theme-provider";
import { z } from "astro/zod";

export default defineTheme({
schema: z.object({
title: z.string(),
description: z.string().optional(),
}),
});
17 changes: 17 additions & 0 deletions package/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
import config from 'my-theme/config'
import 'my-theme/css';
---

<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>{config.title}</title>
</head>
<body>
<slot />
</body>
</html>
16 changes: 16 additions & 0 deletions package/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "my-theme",
"version": "0.0.1",
"description": "My awesome Astro theme created using `astro-theme-provider`!",
"license": "MIT",
"keywords": [
"astro",
"withastro",
"astro-integration"
],
"scripts": {},
"devDependencies": {
"astro": "^4.4.4",
"astro-theme-provider": "^0.1.0"
}
}
47 changes: 47 additions & 0 deletions package/pages/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
import { Image } from "astro:assets";
import { Layout } from "my-theme/layouts";
import { Hero } from "my-theme/components";
import { houston } from "my-theme/assets";
import config from "my-theme/config";
---

<Layout>
<Hero title={config.title} desc={config.description} />
<div class="houston">
<Image src={houston} alt="" />
</div>
</Layout>

<style>
.houston {
animation: hithere 8s ease-in-out infinite;
}

@keyframes hithere {
0% {
transform: rotate(-5deg) scale(1);
}
15% {
transform: rotate(-5deg) scale(1);
}
20% {
transform: rotate(10deg) scale(1.15);
}
25% {
transform: rotate(-20deg) scale(1.15);
}
30% {
transform: rotate(10deg) scale(1.15);
}
35% {
transform: rotate(-20deg) scale(1.15);
}
40% {
transform: rotate(-5deg) scale(1);
}
100% {
transform: rotate(-5deg) scale(1);
}
}
</style>
1 change: 1 addition & 0 deletions package/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
13 changes: 13 additions & 0 deletions playground/astro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "astro/config";
import MyTheme from "my-theme";

export default defineConfig({
integrations: [
MyTheme({
config: {
title: "My Awesome Theme",
description: "My awesome theme is currently under construction!",
},
}),
],
});
16 changes: 16 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "playground",
"private": true,
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"astro": "^4.4.4",
"my-theme": "workspace:^"
}
}
3 changes: 3 additions & 0 deletions playground/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
/// <reference types="../.astro/my-theme.d.ts" />
3 changes: 3 additions & 0 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/strictest"
}
Loading

0 comments on commit 65576d8

Please sign in to comment.