Compare commits
No commits in common. "4145cec102b7ca3677a934cc4dff35977b681599" and "a329ed1cbe9c4f0278571b3f097931260e9ebf5f" have entirely different histories.
4145cec102
...
a329ed1cbe
12 changed files with 129 additions and 184 deletions
26
src/App.tsx
26
src/App.tsx
|
|
@ -2,15 +2,35 @@ import "./styles/reset.css";
|
||||||
import "./styles/App.css";
|
import "./styles/App.css";
|
||||||
import { Outlet } from "react-router";
|
import { Outlet } from "react-router";
|
||||||
import { Link } from "react-router";
|
import { Link } from "react-router";
|
||||||
import Navbar from "./components/navbar/Navbar";
|
import { useGuides } from "./lib/contexts/guide.context";
|
||||||
|
import { NavLink } from "react-router";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const { guides } = useGuides();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header>
|
<header>
|
||||||
<h1><Link to="/">SnapSteps</Link></h1>
|
<h1 className="main-title">
|
||||||
<Navbar />
|
<Link to="/">SnapSteps</Link>
|
||||||
|
</h1>
|
||||||
|
<nav>
|
||||||
|
<Link className="create-new-guide-btn" to="/new-guide">
|
||||||
|
Create New Guide
|
||||||
|
</Link>
|
||||||
|
|
||||||
|
<h2>Guides</h2>
|
||||||
|
<ul className="guide-list">
|
||||||
|
{guides.map((guide) => (
|
||||||
|
<li key={guide.id}>
|
||||||
|
<NavLink to={`/guide/${guide.id}`}>{guide.title}</NavLink>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
<NavLink className="settings-btn" to="/settings">
|
||||||
|
Settings
|
||||||
|
</NavLink>
|
||||||
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
import type { FrameType } from "../../lib/schemas";
|
|
||||||
|
|
||||||
export default function Frame({ frame } : { frame: FrameType }) {
|
|
||||||
return (
|
|
||||||
<div className="frame">
|
|
||||||
<h2>{frame.title}</h2>
|
|
||||||
<img src={URL.createObjectURL(frame.file)} alt={frame.title} />
|
|
||||||
|
|
||||||
<ol className="steps">
|
|
||||||
{frame.steps.map((step, stepIndex) => (
|
|
||||||
<li key={stepIndex} className="step">
|
|
||||||
{step.text}
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
nav {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 100%;
|
|
||||||
padding-bottom: var(--size-lg);
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
a {
|
|
||||||
padding: 0.6rem var(--size-md) 0.5rem;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
line-height: 1;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-button {
|
|
||||||
margin-top: auto;
|
|
||||||
align-self: center;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-button.active {
|
|
||||||
margin-top: auto;
|
|
||||||
align-self: center;
|
|
||||||
color: var(--color-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
margin-top: var(--size-lg);
|
|
||||||
font-size: 1rem;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.guide-list a {
|
|
||||||
transition:
|
|
||||||
background-color 0.125s,
|
|
||||||
border-left 0.125s;
|
|
||||||
background-color: #fff;
|
|
||||||
border-left: 4px solid var(--color-border);
|
|
||||||
}
|
|
||||||
.guide-list a.active {
|
|
||||||
background-color: #fff;
|
|
||||||
border-left: 4px solid var(--color-accent);
|
|
||||||
}
|
|
||||||
.guide-list a:hover:not(.active) {
|
|
||||||
border-left: 4px solid var(--color-accent-hover);
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { Link, NavLink } from "react-router";
|
|
||||||
import "./Navbar.css"
|
|
||||||
import GuideList from "./guide-list/GuideList";
|
|
||||||
|
|
||||||
export default function Navbar() {
|
|
||||||
return (
|
|
||||||
<nav>
|
|
||||||
<Link className="button primary-button" to="/new-guide">
|
|
||||||
Create New Guide
|
|
||||||
</Link>
|
|
||||||
|
|
||||||
<h2>Guides</h2>
|
|
||||||
<GuideList />
|
|
||||||
<NavLink className="button secondary-button settings-button" to="/settings">
|
|
||||||
Settings
|
|
||||||
</NavLink>
|
|
||||||
</nav>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
.guide-list {
|
|
||||||
list-style: none;
|
|
||||||
padding: 0;
|
|
||||||
margin-top: var(--size-sm);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--size-sm);
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import { NavLink } from "react-router";
|
|
||||||
import "./GuideList.css";
|
|
||||||
import { useGuides } from "../../../lib/contexts/guide.context";
|
|
||||||
import type { GuideType } from "../../../lib/schemas";
|
|
||||||
|
|
||||||
export default function GuideList() {
|
|
||||||
const { guides } = useGuides();
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ul className="guide-list">
|
|
||||||
{guides.map((guide: GuideType) => (
|
|
||||||
<li key={guide.id}>
|
|
||||||
<NavLink to={`/guide/${guide.id}`}>{guide.title}</NavLink>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -8,12 +8,6 @@
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
.frame img {
|
|
||||||
max-height: 350px;
|
|
||||||
object-fit: contain;
|
|
||||||
object-position: left center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.frame .buttons {
|
.frame .buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--size-md);
|
gap: var(--size-md);
|
||||||
|
|
@ -26,7 +20,3 @@
|
||||||
.frame .buttons .remove {
|
.frame .buttons .remove {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.frame ol {
|
|
||||||
margin-left: var(--size-md);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export default function Frame({
|
||||||
>
|
>
|
||||||
Add Step
|
Add Step
|
||||||
</button>
|
</button>
|
||||||
<ol className="steps">
|
<div className="steps">
|
||||||
{frame.steps.map((step: StepType, index: number) => (
|
{frame.steps.map((step: StepType, index: number) => (
|
||||||
<Step
|
<Step
|
||||||
key={step.id}
|
key={step.id}
|
||||||
|
|
@ -82,7 +82,7 @@ export default function Frame({
|
||||||
updateStep={updateStep}
|
updateStep={updateStep}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</ol>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ export default function Step({
|
||||||
index: number;
|
index: number;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<li className={"step " + index}>
|
<div className={"step " + index}>
|
||||||
<label>
|
<label>
|
||||||
<span>{index + 1}. </span>
|
<span>{index + 1}. </span>
|
||||||
<input
|
<input
|
||||||
|
|
@ -25,6 +25,6 @@ export default function Step({
|
||||||
<button type="button" onClick={() => removeStep(step.id)}>
|
<button type="button" onClick={() => removeStep(step.id)}>
|
||||||
Remove Step
|
Remove Step
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,11 @@ main:has(.guide) {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide__frames {
|
.guide__frames {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--size-xl);
|
gap: var(--size-xl);
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide {
|
.guide {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
.delete-button {
|
.delete-button {
|
||||||
|
|
@ -17,30 +15,40 @@ main:has(.guide) {
|
||||||
bottom: var(--size-md);
|
bottom: var(--size-md);
|
||||||
right: var(--size-md);
|
right: var(--size-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-button {
|
.edit-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: var(--size-md);
|
top: var(--size-md);
|
||||||
right: 8rem;
|
right: 8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.export-button {
|
.export-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: var(--size-md);
|
top: var(--size-md);
|
||||||
right: var(--size-md);
|
right: var(--size-md);
|
||||||
}
|
}
|
||||||
|
.guide__frame {
|
||||||
|
padding: var(--size-md);
|
||||||
|
background-color: var(--color-bg-panel);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--size-sm);
|
||||||
|
}
|
||||||
|
.guide__frame img {
|
||||||
|
max-height: 350px;
|
||||||
|
object-fit: contain;
|
||||||
|
object-position: left center;
|
||||||
|
}
|
||||||
|
.guide__frame ol {
|
||||||
|
margin-left: var(--size-md);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media print {
|
@media print {
|
||||||
main:has(.guide) {
|
main:has(.guide) {
|
||||||
padding: 0rem;
|
padding: 0rem;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide__frames {
|
.guide__frames {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide__frame {
|
.guide__frame {
|
||||||
position: relative;
|
position: relative;
|
||||||
break-inside: avoid;
|
break-inside: avoid;
|
||||||
|
|
@ -48,7 +56,6 @@ main:has(.guide) {
|
||||||
background-color: var(--color-bg-panel);
|
background-color: var(--color-bg-panel);
|
||||||
margin: var(--size-lg) 0;
|
margin: var(--size-lg) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide__frame img {
|
.guide__frame img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100px;
|
max-height: 100px;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import "./Guide.css";
|
||||||
import { useParams, Link } from "react-router";
|
import { useParams, Link } from "react-router";
|
||||||
import { useGuides } from "../../../lib/contexts/guide.context";
|
import { useGuides } from "../../../lib/contexts/guide.context";
|
||||||
import useGuide from "../hooks/useGuide";
|
import useGuide from "../hooks/useGuide";
|
||||||
import Frame from "../../../components/frame/Frame";
|
|
||||||
|
|
||||||
export default function Guide() {
|
export default function Guide() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
@ -21,7 +20,18 @@ export default function Guide() {
|
||||||
|
|
||||||
<div className="guide__frames">
|
<div className="guide__frames">
|
||||||
{guide.frames.map((frame, index) => (
|
{guide.frames.map((frame, index) => (
|
||||||
<Frame key={index} frame={frame} />
|
<div key={index} className="guide__frame frame">
|
||||||
|
<h2>{frame.title}</h2>
|
||||||
|
<img src={URL.createObjectURL(frame.file)} alt={frame.title} />
|
||||||
|
|
||||||
|
<ol className="steps">
|
||||||
|
{frame.steps.map((step, stepIndex) => (
|
||||||
|
<li key={stepIndex} className="guide__step">
|
||||||
|
{step.text}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
:root {
|
:root {
|
||||||
/* color */
|
/* color */
|
||||||
--color-border: oklch(87.1% 0.006 286.286);
|
--color-border: #ccc;
|
||||||
--color-bg-sidebar: oklch(92% 0.004 286.32);
|
--color-bg-sidebar: #eee;
|
||||||
--color-bg-panel: oklch(96.7% 0.001 286.375);
|
--color-bg-panel: #fafafa;
|
||||||
|
--color-accent: #ff7700;
|
||||||
--color-accent: oklch(70.5% 0.213 47.604);
|
--color-accent-hover: #ff9900;
|
||||||
--color-accent-hover: oklch(75% 0.183 55.934);
|
--color-accent-border: #ff770080;
|
||||||
--color-accent-border: oklch(83.7% 0.128 66.29);
|
--color-accent-bg-subtle: #ff770010;
|
||||||
--color-accent-bg-subtle: oklch(98% 0.016 73.684);
|
|
||||||
|
|
||||||
/* layout */
|
/* layout */
|
||||||
--sidebar-width: 250px;
|
--sidebar-width: 250px;
|
||||||
|
|
@ -20,20 +19,19 @@
|
||||||
--size-md: 1rem;
|
--size-md: 1rem;
|
||||||
--size-lg: 2rem;
|
--size-lg: 2rem;
|
||||||
--size-xl: 3rem;
|
--size-xl: 3rem;
|
||||||
--size-2xl: 4rem;
|
|
||||||
--size-3xl: 5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
font-family: system-ui, Arial, sans-serif;
|
font-family: system-ui, Arial, sans-serif;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
#root {
|
#root {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
.app-body {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
header {
|
header {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
@ -45,19 +43,33 @@ header {
|
||||||
gap: var(--size-sm);
|
gap: var(--size-sm);
|
||||||
border-right: 3px solid var(--color-border);
|
border-right: 3px solid var(--color-border);
|
||||||
background-color: var(--color-bg-sidebar);
|
background-color: var(--color-bg-sidebar);
|
||||||
|
.main-title a {
|
||||||
h1 a {
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
.create-new-guide-btn {
|
||||||
|
padding: var(--size-sm) var(--size-md);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
background-color: var(--color-accent);
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.guide-list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin-top: var(--size-sm);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--size-sm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
margin-left: var(--sidebar-width);
|
margin-left: var(--sidebar-width);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: var(--size-md);
|
padding: var(--size-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
@ -67,9 +79,52 @@ footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: var(--sidebar-width);
|
width: var(--sidebar-width);
|
||||||
}
|
}
|
||||||
|
nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: var(--size-lg);
|
||||||
|
width: 100%;
|
||||||
|
a {
|
||||||
|
padding: 0.6rem var(--size-md) 0.5rem;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
line-height: 1;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.settings-btn {
|
||||||
|
margin-top: auto;
|
||||||
|
align-self: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.settings-btn.active {
|
||||||
|
margin-top: auto;
|
||||||
|
align-self: center;
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
margin-top: var(--size-lg);
|
||||||
|
font-size: 1rem;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.guide-list a {
|
||||||
|
transition:
|
||||||
|
background-color 0.125s,
|
||||||
|
border-left 0.125s;
|
||||||
|
background-color: #fff;
|
||||||
|
border-left: 4px solid var(--color-border);
|
||||||
|
}
|
||||||
|
.guide-list a.active {
|
||||||
|
background-color: #fff;
|
||||||
|
border-left: 4px solid var(--color-accent);
|
||||||
|
}
|
||||||
|
.guide-list a:hover:not(.active) {
|
||||||
|
border-left: 4px solid var(--color-accent-hover);
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
ul {
|
ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -77,7 +132,6 @@ ul {
|
||||||
gap: var(--size-xs);
|
gap: var(--size-xs);
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a,
|
a,
|
||||||
input,
|
input,
|
||||||
button,
|
button,
|
||||||
|
|
@ -87,31 +141,9 @@ textarea {
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.primary-button {
|
|
||||||
padding: var(--size-sm) var(--size-md);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
background-color: var(--color-accent);
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.secondary-button {
|
|
||||||
padding: var(--size-sm) var(--size-md);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
background-color: var(--color-bg-sidebar);
|
|
||||||
color: #000;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
input,
|
input,
|
||||||
textarea,
|
textarea,
|
||||||
.file-upload {
|
.file-upload {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue