Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
17ff0a7
added files and basic html
May 1, 2025
bdfb165
added html, classes and structure for adding new messages/happy thoughts
May 1, 2025
7457c50
added styling and message form
May 1, 2025
6cf7289
added message list and message card
May 1, 2025
7e4472e
added more classes and styling
May 1, 2025
ff0e91a
corrected paragrapgh wording, added class and styling
May 2, 2025
a7959e5
added illustration and styling
May 24, 2025
8d8bf90
added illustration and styling
May 24, 2025
64fbbf1
Removed and added classes in html for better page layout. Added styli…
May 24, 2025
151011f
added fetch for happy thoughts from remote API and handlelike function
May 25, 2025
986a48f
added messagecard component with like button and time-ago formatting
May 25, 2025
e1a2c20
added validated message form with API POST request
May 25, 2025
d3d6132
added onLike prop to message card to enable likes
May 25, 2025
9edac10
removed and added styling
May 25, 2025
b009565
making changes to import the image
May 25, 2025
8e22a50
removed redundant class and changed color contrast of text
May 25, 2025
d65bd89
added meta description to increase seo in lighthouse
May 25, 2025
4bf1cf4
changed API link
May 26, 2025
adc18e7
changed the API link in message form
May 26, 2025
e0e8f59
Update README.md
T-Thiry May 28, 2025
6771273
Update README.md
T-Thiry May 29, 2025
811a5f3
added SignupForm file and import
Aug 10, 2025
c50c74b
Added new code
Aug 12, 2025
72a3bc3
Added user as a pop and uncluded user in the body
Aug 12, 2025
786639e
Saving user in localstorage
Aug 12, 2025
5000838
Removed user from body and added response to onAddMessage
Aug 12, 2025
2f04c85
Added user to body
Aug 12, 2025
3c6e69c
Removed localStorage and user prop
Aug 12, 2025
d984bec
Added class to submit button and styled the button
Aug 13, 2025
7ddb1ec
Added handleDelete function and passed the prop in home, messageCard …
Aug 14, 2025
25a9185
Removed the disabled attribute to set the page state to home
Aug 14, 2025
c81e991
Added handleEdit function and passed prop onEdit to home, messageCard…
Aug 14, 2025
c9bfcee
Added button class to buttons and structured the css
Aug 14, 2025
c6b13b4
Added another shade to error text
Aug 14, 2025
d3a1cce
Added class error-text to paragraph
Aug 14, 2025
078cf3a
Added disabled prop and changed media queries
Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Happy Thoughts

A Happy Thoughts app built with React and Hooks, where users can share and like positive messages fetched from an external API.

https://tthiry-happythoughts.netlify.app

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! I really enjoyed checking out your Happy Thoughts project. Nice work the code is really easy to read and maintain.

That said, you should definitely be proud of what you’ve built!

1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Happy Thoughts is a place to share positive messages!" />
<title>Happy Thoughts</title>
</head>
<body>
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"react-router-dom": "^7.8.0",
"styled-components": "^6.1.19"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
Expand Down
356 changes: 356 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,356 @@
/* Define CSS Variables */
:root {
--primary-color: #FFA0C1;
--text-color: #1E1E1E;
--secondary-bg: #F0F0F0;
--disabled-bg: #D3D3D3;
--disabled-text: #A9A9A9;
--error-color: #c82020;
--placeholder-color: #767676;
--border-color: #CCCCCC;
}

/* Global Styles */
body {
margin: 0;
padding: 0;
font-family: 'Segoe UI', sans-serif;
background: #F9F9F9;
}

h1 {
font-size: 1.5rem;
margin: 1rem 0;
text-align: center;
}

p {
color: var(--error-color);
max-width: 70%;
}

input {
color:rgb(171, 171, 171);
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 1rem;
}

button {
background: var(--primary-color);
color: var(--text-color);
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 1rem;
cursor: pointer;
}

.submit-button:disabled {
background-color: var(--disabled-bg);
color: var(--disabled-text);
cursor: not-allowed;
opacity: 0.7;
}

/* Layout */
.outer-wrapper {
max-width: 500px;
margin: 0 auto;
padding: 0 1rem;
}

.app-container {
padding: 1rem;
background-color: #FFFFFF;
border: 1px solid var(--primary-color);
margin-bottom: 1rem;
box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.7);
}

/* Header */
.header {
display: flex;
align-items: center;
justify-content: center;
margin: 2rem 1rem 1rem 1rem;
flex-wrap: wrap;
text-align: center;
}

.header img {
width: 70px;
height: auto;
}

/* Message components */
.message-container {
display: flex;
flex-direction: column;
gap: 1rem;
margin-bottom: 4rem;
}

.message-card {
position: relative;
width: 100%;
padding: 1rem;
box-sizing: border-box;
background: #FFFFFF;
border: 1px solid var(--primary-color);
word-break: break-word;
box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.7);
}

.message-card small {
font-size: 0.9rem;
font-weight: 300;
display: block;
margin-top: 1rem;
color: var(--placeholder-color);
}

.message-actions {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 1rem;
}

.message-list {
display: flex;
align-items: center;
flex-direction: column;
gap: 1rem;
}

.like-button {
background-color: rgb(233, 233, 233);
border: 1px solid rgb(233, 233, 233);
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
padding: 0;
}

.like-button.liked {
background-color: var(--primary-color);
border-color: var(--primary-color);
}

.like-count {
margin-left: 8px;
font-size: 1rem;
color: var(--placeholder-color);
}

.time-ago {
margin-left: auto;
font-size: 0.8rem;
color: var(--placeholder-color);
}

/* Form styles */
form {
display: flex;
flex-direction: column;
gap: 1rem;
width: 100%;
max-width: 350px;
}

.message-form {
display: flex;
flex-direction: column;
gap: 1rem;
margin: 2rem 0;
}

.message-form textarea {
resize: none;
padding: 1rem;
font-size: 1rem;
border-radius: 8px;
border: 1px solid var(--border-color);
}

.message-form textarea::placeholder {
color: var(--placeholder-color);
}

.message-form button {
width: 100%;
padding: 0.5rem;
font-size: 1rem;
background-color: var(--primary-color);
border: none;
border-radius: 8px;
color: var(--text-color);
cursor: pointer;
transition: background 0.3s ease;
}

/* Error Text */
.error-text {
color: var(--error-color);
font-size: 0.9rem; /* Optional: Adjust font size */
margin-top: 0.5rem; /* Optional: Add spacing */
}

/* Edit/Delete Buttons */
.button {
padding: 0.5rem 1rem;
border-radius: 4px;
border: none;
cursor: pointer;
font-size: 0.9rem;
transition: background 0.3s ease;
}

.save-button {
background-color: var(--primary-color);
color: var(--text-color);
}

.cancel-button {
background-color: var(--secondary-bg);
color: var(--text-color);
}

.submit-button {
background-color: var(--primary-color);
color: var(--text-color);
}

.submit-button:disabled {
background-color: var(--disabled-bg);
color: var(--disabled-text);
cursor: not-allowed;
opacity: 0.7;
}

.edit-button,
.delete-button {
background: none;
border: none;
color: var(--text-color);
cursor: pointer;
font-size: 0.9rem;
}

.edit-button {
padding: 5px 10px;
border-radius: 5px;
}

.edit-button:hover,
.delete-button:hover {
background-color: #E0E0E0;
}

.delete-message button {
background: none;
border: none;
color: var(--text-color);
cursor: pointer;
}

.delete-message button:hover {
background-color: var(--secondary-bg);
color: var(--error-color); /* Highlight the delete button in red */
}

.delete-message button:focus {
outline: 2px solid var(--primary-color); /* Add focus outline for accessibility */
}

div > div > p {
color: var(--text-color);
}

/* Signup/Login Containers */
.signup-container,
.login-container {
margin: 2rem;
}

/* Edit Actions */
.top-right-actions {
position: absolute;
top: 10px;
right: 10px;
display: flex;
}

.edit-container {
display: flex;
flex-direction: column;
gap: 0.5rem;
}

.edit-textarea {
width: 80%;
padding: 0.5rem;
font-size: 1rem;
border: 1px solid var(--border-color);
border-radius: 4px;
}

.edit-buttons {
display: flex;
gap: 0.5rem;
}


/* Responsive design */
@media (min-width: 400px) {
.header h1 {
font-size: 2rem;
margin: 2rem 0;
}

.header img {
width: 80px;
}

.top-right-actions {
gap: 0.5rem;
}
}

@media (max-width: 600px) {
.app-container {
padding: 1rem;
}

.message-form textarea {
font-size: 0.9rem;
}
}

@media (min-width: 768px) {
.header {
flex-direction: row;
justify-content: center;
text-align: left;
gap: 1rem;
}

.header h1 {
font-size: 2.25rem;
margin: 2rem 0;
}

.header img {
width: 100px;
}

.message-form button {
width: 50%;
}
}
Loading