-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7d887e3
Showing
29 changed files
with
7,980 additions
and
0 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,31 @@ | ||
name: build | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: npm | ||
- name: npm install, build, and test | ||
run: | | ||
npm install | ||
npm run compile | ||
npm run lint | ||
npm run test | ||
env: | ||
CI: true |
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,69 @@ | ||
|
||
# Created by https://www.gitignore.io/api/node | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
|
||
# End of https://www.gitignore.io/api/node | ||
|
||
lib/ | ||
|
||
*.tsbuildinfo |
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,2 @@ | ||
lib/ | ||
*.tsbuildinfo |
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,7 @@ | ||
trailingComma: all | ||
tabWidth: 2 | ||
semi: true | ||
singleQuote: false | ||
bracketSpacing: true | ||
printWidth: 120 | ||
arrowParens: avoid |
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,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright 2024 Sajjad Hashemian | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,26 @@ | ||
/vendor | ||
/twenty* | ||
index.php | ||
|
||
# build output | ||
dist/ | ||
theme/ | ||
|
||
# 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 |
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,12 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import wp from 'wp-astro'; | ||
import react from "@astrojs/react"; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
vite: {}, | ||
adapter: wp({ | ||
devProxyTarget: 'http://localhost:8001', | ||
}), | ||
integrations: [react()] | ||
}); |
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,23 @@ | ||
{ | ||
"name": "@sijad/wp-astro-demo", | ||
"private": true, | ||
"type": "module", | ||
"version": "0.0.1", | ||
"scripts": { | ||
"dev": "astro dev", | ||
"start": "astro dev", | ||
"build": "astro check && astro build", | ||
"preview": "astro preview", | ||
"astro": "astro" | ||
}, | ||
"dependencies": { | ||
"@astrojs/check": "^0.4.1", | ||
"@astrojs/react": "^3.0.9", | ||
"@types/react": "^18.2.47", | ||
"@types/react-dom": "^18.2.18", | ||
"astro": "4", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"wp-astro": "file:../packages/wp-astro" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,8 @@ | ||
<?php | ||
|
||
function theme_setup(){ | ||
add_theme_support( 'automatic-feed-links' ); | ||
add_theme_support( 'title-tag' ); | ||
} | ||
add_action('after_setup_theme','theme_setup'); | ||
|
Empty file.
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,61 @@ | ||
--- | ||
interface Props { | ||
title: string; | ||
body: string; | ||
href: string; | ||
} | ||
const { href, title, body } = Astro.props; | ||
--- | ||
|
||
<li class="link-card"> | ||
<a href={href}> | ||
<h2> | ||
{title} | ||
<span>→</span> | ||
</h2> | ||
<p> | ||
{body} | ||
</p> | ||
</a> | ||
</li> | ||
<style> | ||
.link-card { | ||
list-style: none; | ||
display: flex; | ||
padding: 1px; | ||
background-color: #23262d; | ||
background-image: none; | ||
background-size: 400%; | ||
border-radius: 7px; | ||
background-position: 100%; | ||
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1); | ||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); | ||
} | ||
.link-card > a { | ||
width: 100%; | ||
text-decoration: none; | ||
line-height: 1.4; | ||
padding: calc(1.5rem - 1px); | ||
border-radius: 8px; | ||
color: white; | ||
background-color: #23262d; | ||
opacity: 0.8; | ||
} | ||
h2 { | ||
margin: 0; | ||
font-size: 1.25rem; | ||
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1); | ||
} | ||
p { | ||
margin-top: 0.5rem; | ||
margin-bottom: 0; | ||
} | ||
.link-card:is(:hover, :focus-within) { | ||
background-position: 0; | ||
background-image: var(--accent-gradient); | ||
} | ||
.link-card:is(:hover, :focus-within) h2 { | ||
color: rgb(var(--accent-light)); | ||
} | ||
</style> |
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,11 @@ | ||
.counter { | ||
display: grid; | ||
font-size: 2em; | ||
grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
margin-top: 2em; | ||
place-items: center; | ||
} | ||
|
||
.counter-message { | ||
text-align: center; | ||
} |
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,25 @@ | ||
import { useState } from 'react'; | ||
import './Counter.css'; | ||
|
||
export default function Counter({ | ||
children, | ||
count: initialCount, | ||
}: { | ||
children: JSX.Element; | ||
count: number; | ||
}) { | ||
const [count, setCount] = useState(initialCount); | ||
const add = () => setCount((i) => i + 1); | ||
const subtract = () => setCount((i) => i - 1); | ||
|
||
return ( | ||
<> | ||
<div className="counter"> | ||
<button onClick={subtract}>-</button> | ||
<pre>{count}</pre> | ||
<button onClick={add}>+</button> | ||
</div> | ||
<div className="counter-message">{children}</div> | ||
</> | ||
); | ||
} |
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 @@ | ||
/// <reference types="astro/client" /> |
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,49 @@ | ||
--- | ||
const initPhpCode = `<?php wp_head(); ?>`; | ||
const endPhpCode = `<?php wp_footer(); ?>`; | ||
--- | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="description" content="Astro description" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="generator" content={Astro.generator} /> | ||
<Fragment set:html={initPhpCode}} /> | ||
</head> | ||
<body> | ||
<slot /> | ||
<Fragment set:html={endPhpCode} /> | ||
</body> | ||
</html> | ||
<style is:global> | ||
:root { | ||
--accent: 136, 58, 234; | ||
--accent-light: 224, 204, 250; | ||
--accent-dark: 49, 10, 101; | ||
--accent-gradient: linear-gradient( | ||
45deg, | ||
rgb(var(--accent)), | ||
rgb(var(--accent-light)) 30%, | ||
white 60% | ||
); | ||
} | ||
html { | ||
font-family: system-ui, sans-serif; | ||
background: #13151a; | ||
background-size: 224px; | ||
} | ||
code { | ||
font-family: | ||
Menlo, | ||
Monaco, | ||
Lucida Console, | ||
Liberation Mono, | ||
DejaVu Sans Mono, | ||
Bitstream Vera Sans Mono, | ||
Courier New, | ||
monospace; | ||
} | ||
</style> |
Oops, something went wrong.