Skip to content

Commit

Permalink
add basic starter
Browse files Browse the repository at this point in the history
  • Loading branch information
shairez committed Nov 21, 2024
1 parent 34d4324 commit 3710529
Show file tree
Hide file tree
Showing 26 changed files with 852 additions and 4 deletions.
13 changes: 13 additions & 0 deletions starters/apps/basic-starter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "qwik-basic-starter",
"description": "One page app ready to go",
"type": "module",
"__qwik__": {
"priority": 2,
"displayName": "Basic App (Qwik City + Qwik)",
"qwikCity": true,
"docs": [
"https://qwik.dev/docs/getting-started/"
]
}
}
1 change: 1 addition & 0 deletions starters/apps/basic-starter/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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions starters/apps/basic-starter/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
"name": "qwik-project-name",
"short_name": "Welcome to Qwik",
"start_url": ".",
"display": "standalone",
"background_color": "#fff",
"description": "A Qwik project app."
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useDocumentHead, useLocation } from "@builder.io/qwik-city";

import { component$ } from "@builder.io/qwik";

/**
* The RouterHead component is placed inside of the document `<head>` element.
*/
export const RouterHead = component$(() => {
const head = useDocumentHead();
const loc = useLocation();

return (
<>
<title>{head.title}</title>

<link rel="canonical" href={loc.url.href} />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />

{head.meta.map((m) => (
<meta key={m.key} {...m} />
))}

{head.links.map((l) => (
<link key={l.key} {...l} />
))}

{head.styles.map((s) => (
<style
key={s.key}
{...s.props}
{...(s.props?.dangerouslySetInnerHTML
? {}
: { dangerouslySetInnerHTML: s.style })}
/>
))}

{head.scripts.map((s) => (
<script
key={s.key}
{...s.props}
{...(s.props?.dangerouslySetInnerHTML
? {}
: { dangerouslySetInnerHTML: s.script })}
/>
))}
</>
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.anchor {
color: white !important;
display: block;
font-size: 0.8rem;
text-align: center;
text-decoration: none;
line-height: 1.5;
}

.anchor span:not(.spacer) {
display: block;
}

.spacer {
display: none;
padding: 0 15px;
}

@media screen and (min-width: 768px) {
.anchor span {
display: inline !important;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { component$ } from "@builder.io/qwik";
import { useServerTimeLoader } from "../../../routes/layout";
import styles from "./footer.module.css";

export default component$(() => {
const serverTime = useServerTimeLoader();

return (
<footer>
<p class={styles.anchor}>
<span>Made with ♡ by the Qwik Team</span>
<span class={styles.spacer}>|</span>
<span>{serverTime.value.date}</span>
</p>
</footer>
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.wrapper {
display: flex;
align-items: center;
justify-content: space-between;
}

.logo {
display: inline-block;
}
.logo a {
display: block;
}

.header ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
gap: 30px;
}

.header li {
display: none;
margin: 0;
padding: 0;
font-size: 0.7rem;
}

.header li a {
color: white;
display: inline-block;
padding: 0;
text-decoration: none;
}

.header li a:hover {
color: var(--qwik-light-blue);
}

@media (min-width: 450px) {
.header li {
display: inline-block;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { component$ } from "@builder.io/qwik";
import { QwikLogo } from "../icons/qwik";
import styles from "./header.module.css";

export default component$(() => {
return (
<header class={styles.header}>
<div class={["container", styles.wrapper]}>
<div class={styles.logo}>
<a href="/" title="qwik">
<QwikLogo height={50} width={143} />
</a>
</div>
<ul>
<li>
<a
href="https://qwik.dev/docs/components/overview/"
target="_blank"
>
Docs
</a>
</li>
<li>
<a
href="https://qwik.dev/examples/introduction/hello-world/"
target="_blank"
>
Examples
</a>
</li>
<li>
<a
href="https://qwik.dev/tutorial/welcome/overview/"
target="_blank"
>
Tutorials
</a>
</li>
</ul>
</div>
</header>
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.hero {
display: flex;
vertical-align: middle;
flex-direction: column;
flex-wrap: nowrap;
align-items: center;
height: 450px;
justify-content: center;
gap: 40px;
}

.hero-image {
width: 100%;
position: absolute;
height: auto;
object-fit: cover;
z-index: -1;
opacity: 0.2;
pointer-events: none;
}

.hero p {
color: white;
margin: 0;
font-size: 1rem;
}

.button-group {
display: flex;
flex-direction: row;
gap: 24px;
}

@media screen and (min-width: 768px) {
.hero {
gap: 60px;
height: 500px;
}

.hero p {
font-size: 1.3rem;
}
}
82 changes: 82 additions & 0 deletions starters/apps/basic-starter/src/components/starter/hero/hero.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { component$ } from "@builder.io/qwik";
import styles from "./hero.module.css";
import ImgThunder from "../../../media/thunder.png?jsx";

export default component$(() => {
return (
<div class={["container", styles.hero]}>
<ImgThunder class={styles["hero-image"]} alt="Image thunder" />
<h1>
So <span class="highlight">fantastic</span>
<br />
to have <span class="highlight">you</span> here
</h1>
<p>Have fun building your App with Qwik.</p>
<div class={styles["button-group"]}>
<button
onClick$={async () => {
const defaults = {
spread: 360,
ticks: 70,
gravity: 0,
decay: 0.95,
startVelocity: 30,
colors: ["006ce9", "ac7ff4", "18b6f6", "713fc2", "ffffff"],
origin: {
x: 0.5,
y: 0.35,
},
};

function loadConfetti() {
return new Promise<(opts: any) => void>((resolve, reject) => {
if ((globalThis as any).confetti) {
return resolve((globalThis as any).confetti as any);
}
const script = document.createElement("script");
script.src =
"https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js";
script.onload = () =>
resolve((globalThis as any).confetti as any);
script.onerror = reject;
document.head.appendChild(script);
script.remove();
});
}

const confetti = await loadConfetti();

function shoot() {
confetti({
...defaults,
particleCount: 80,
scalar: 1.2,
});

confetti({
...defaults,
particleCount: 60,
scalar: 0.75,
});
}

setTimeout(shoot, 0);
setTimeout(shoot, 100);
setTimeout(shoot, 200);
setTimeout(shoot, 300);
setTimeout(shoot, 400);
}}
>
Time to celebrate
</button>
<a
href="https://qwik.dev/docs"
target="_blank"
class="button button-dark"
>
Explore the docs
</a>
</div>
</div>
);
});
44 changes: 44 additions & 0 deletions starters/apps/basic-starter/src/components/starter/icons/qwik.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export const QwikLogo = ({
width = 100,
height = 35,
}: {
width?: number;
height?: number;
}) => (
<svg
width={width}
height={height}
viewBox="0 0 167 53"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M81.9545 46.5859H75.5513V35.4045C73.4363 36.8579 71.0496 37.5749 68.4884 37.5749C65.0151 37.5749 62.4344 36.6253 60.8239 34.6487C59.2134 32.6915 58.3984 29.2034 58.3984 24.2231C58.3984 19.1266 59.3492 15.5997 61.2702 13.5456C63.23 11.4721 66.3734 10.4644 70.7004 10.4644C74.7946 10.4644 78.5201 11.0264 81.9545 12.131V46.5859ZM75.5513 16.278C74.096 15.8323 72.4661 15.6191 70.7004 15.6191C68.5272 15.6191 66.9749 16.1811 66.1017 17.3244C65.2479 18.4871 64.7823 20.6962 64.7823 23.9712C64.7823 27.0524 65.1897 29.1065 66.0435 30.2304C66.8973 31.335 68.3719 31.897 70.5452 31.897C73.3781 31.897 75.5513 30.7343 75.5513 29.2809V16.278Z"
fill="white"
/>
<path
d="M91.133 11.1426C93.4033 17.4406 95.3242 23.7386 96.993 30.0948C99.205 23.5836 101.087 17.2856 102.542 11.1426H108.15C110.265 17.4406 112.031 23.7386 113.447 30.0948C115.97 23.196 117.949 16.8787 119.404 11.1426H125.71C123.033 20.173 120.064 28.777 116.785 36.8966H109.256C108.402 32.3039 107.044 26.7617 105.22 20.1536C104.056 25.2889 102.445 30.8893 100.33 36.8966H92.8018C90.2793 27.5174 87.5434 18.9522 84.6328 11.1426H91.133Z"
fill="white"
/>
<path
d="M132.832 7.55758C129.999 7.55758 129.203 6.85996 129.203 3.97257C129.203 1.39523 130.018 0.794495 132.832 0.794495C135.665 0.794495 136.46 1.39523 136.46 3.97257C136.46 6.85996 135.665 7.55758 132.832 7.55758ZM129.649 11.1426H136.053V36.8966H129.649V11.1426Z"
fill="white"
/>
<path
d="M166.303 11.1426C161.763 17.5956 158.581 21.5295 156.815 22.9441C158.27 23.8937 162.17 28.8933 167.002 36.916H159.628C153.613 27.7887 150.742 23.8549 149.325 23.2542V36.916H142.922V0H149.325V23.2348C150.78 22.169 153.963 18.1382 158.872 11.1426H166.303Z"
fill="white"
/>
<path
d="M40.973 52.5351L32.0861 43.6985L31.9503 43.7179V43.621L13.0511 24.9595L17.708 20.4637L14.9721 4.76715L1.99103 20.8513C-0.220992 23.0798 -0.628467 26.7036 0.962635 29.3778L9.07337 42.8265C10.3152 44.9 12.566 46.1402 14.9915 46.1208L19.0081 46.082L40.973 52.5351Z"
fill="#18B6F6"
/>
<path
d="M45.8232 20.5411L44.038 17.2468L43.1066 15.5609L42.738 14.902L42.6992 14.9408L37.8094 6.47238C36.587 4.34075 34.2974 3.02301 31.8137 3.04239L27.5255 3.15865L14.7384 3.19741C12.313 3.21679 10.101 4.49577 8.87853 6.56927L1.09766 21.9945L15.0101 4.72831L33.2496 24.7656L30.0091 28.0406L31.9495 43.7178L31.9689 43.679V43.7178H31.9301L31.9689 43.7565L33.4824 45.2293L40.8364 52.4187C41.1469 52.7094 41.6514 52.3606 41.4379 51.9924L36.8975 43.0589L44.8142 28.4282L45.0664 28.1375C45.1634 28.0212 45.2604 27.905 45.3381 27.7887C46.8904 25.6764 47.1038 22.8472 45.8232 20.5411Z"
fill="#AC7EF4"
/>
<path
d="M33.3076 24.6882L15.0099 4.74774L17.61 20.3668L12.9531 24.882L31.9105 43.6985L30.203 28.0794L33.3076 24.6882Z"
fill="white"
/>
</svg>
);
Loading

0 comments on commit 3710529

Please sign in to comment.