Skip to content

Commit

Permalink
Merging stylish-styles and fixing link issue on production
Browse files Browse the repository at this point in the history
  • Loading branch information
narwhal87 committed Oct 1, 2024
2 parents 4f0220f + fa16209 commit cda84ff
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "my-app",
"version": "0.1.0",
"private": true,
"homepage": ".",
"homepage": "/~alpt22/editor",
"dependencies": {
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
Expand Down
Binary file added public/arches.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"sizes": "512x512"
}
],
"start_url": ".",
"start_url": "/~alpt22/editor",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
Expand Down
18 changes: 14 additions & 4 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
ul {
list-style: none;
margin: 0 auto;
max-width: 600px;
max-width: 80%;
}

li {
max-width: 600px;
border-bottom: 1px solid #c2c4c9;
padding: 1rem;
max-width: 100%;
text-align: left;
margin-bottom: 20px;
}
Expand All @@ -35,13 +37,15 @@ li a {
font-size: 1.6rem;
}

.doc-content-div {
padding-top: 2rem;
}

label {
margin-right: 5px;
font-size: 1.6rem;
}



.ql-editor {
min-height: 200px;
}
Expand Down Expand Up @@ -69,3 +73,9 @@ label {
transform: rotate(360deg);
}
}

.docs {
padding: 2rem;
border-radius: 15px;
background-color: rgb(236, 229, 216);
}
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import './App.css';

export default function App() {
return (
<Router>
<Router basename="/~alpt22/editor">

<div className="App">
<Header />
Expand Down
5 changes: 3 additions & 2 deletions src/all-documents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getAll } from "./models/fetch";

//Components
import DocContent from "./doc-content";
import { Link } from "react-router-dom";

export default function AllDocuments() {
const [docs, setDocs] = useState([]);
Expand All @@ -26,12 +27,12 @@ export default function AllDocuments() {

const docItems = docs.map(doc =>
<li key={doc._id}>
<a href={'/id/' + doc._id}>{doc.title}</a>
<Link to={'/id/' + doc._id}>{doc.title}</Link>
<DocContent doccontent={doc.content} />
</li>
);

return <ul>{docItems}</ul>;
return <ul className="docs">{docItems}</ul>;
} catch (error) {
console.error("An error occurred.", error);
return (
Expand Down
18 changes: 18 additions & 0 deletions src/doc.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
form {
padding: 2rem;
border-radius: 15px;
background-color: rgb(236, 229, 216);
margin: 1rem 2rem;
label {
font-size: 1rem;
}
}

.ql-editor {
background-color: #fff;
}

#title {
font-size: 1rem;
}

16 changes: 15 additions & 1 deletion src/forms/new-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function NewForm() {
} = useForm();

const onSubmit = async (data) => {

data.content = value;
console.log("Data: ", data);
const response = await addOne(data);
Expand All @@ -30,7 +31,20 @@ export function NewForm() {
<form onSubmit={handleSubmit(onSubmit)}>
{/* register your input into the hook by invoking the "register" function */}
<label htmlFor="title">Title</label>
<input id="title" type="text" name="title" {...register("title")} />
<input
id="title"
aria-invalid={errors.name ? "true" : "false"}
type="text"
name="title"
required="true"
{...register("title")}
onInvalid={e => {
e.currentTarget.setCustomValidity("A document title is required");
}}
onChange={e => {
e.currentTarget.setCustomValidity("");
}}
/>

{/* include validation with required or other standard HTML validation rules */}
<ReactQuill ReactQuill theme="snow" id='content' value={value} onChange={setValue} />
Expand Down
23 changes: 23 additions & 0 deletions src/header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.top {
display: flex;
gap: 10px;
row-gap: 10px;
column-gap: 10px;
justify-content: space-between;
margin-left: 3rem;
margin-right: 4rem;
img {
margin: 1rem;
border-radius: 15px;
}
}

.nav {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-end;
a {
text-decoration: none;
}
}
12 changes: 9 additions & 3 deletions src/header.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { Link } from "react-router-dom";
import "./header.css";

function Header() {
return (
<header>
{
<div>
<a href="/"><h1>Home</h1></a>
<a href="/new"><h1>New</h1></a>
<div className="top">
<Link to="/"><img src='logo192.png' /></Link>
<div className="nav">
<Link to="/"><h1>Home</h1></Link>
<Link to="/new"><h1>New</h1></Link>
</div>
</div>
}
</header>
Expand Down
2 changes: 2 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #009fe8;
background-image: url("../public/arches.png");
}

code {
Expand Down
1 change: 1 addition & 0 deletions src/new-doc.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./doc.css";
import { NewForm } from './forms/new-form.jsx';

export default function NewDoc() {
Expand Down
1 change: 1 addition & 0 deletions src/update-doc.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./doc.css";
import { UpdateForm } from './forms/update-form.jsx';

export default function UpdateDoc() {
Expand Down

0 comments on commit cda84ff

Please sign in to comment.