Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/styleReviewPage #112

Merged
merged 7 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/components/CompanyOverview/companyOverview.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
background-color: #333;
border-radius: 4px;
border: 1px solid #444;
color: #e0e0e0;
color: white;
font-size: 1.8rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
color: #e0e0e0;
font-size: 1.2rem;
box-sizing: border-box;
margin-top: 15px;
}

.company-name {
Expand Down
2 changes: 1 addition & 1 deletion src/components/LeftSidebar/LeftSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function LeftSidebar() {
return (
<aside className="leftSideBar_left-sidebar">
<section className="leftSideBar_favorite-companies">
<h3>Favorite Companies</h3>
<h3 className="leftSideBar_h3">Favorite Companies</h3>
<ul className="leftSideBar_favorite-list">
{favoriteCompanies.slice(0,6).map((company, index) => (
<li key={`favoriteCompany${index}`}>
Expand Down
14 changes: 10 additions & 4 deletions src/components/LeftSidebar/leftSidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,36 @@
gap: 1.5rem;
}

.leftSideBar_h3 {
color: black;
text-align: center;
}

.leftSideBar_favorite-companies {
background-color: #a47551;
padding: 1rem;
padding: .5rem;
border: 1px solid #444;
border-radius: 4px;
}
.leftSideBar_favorite-list {
color: white;
list-style: none;
display: flex;
flex-direction: column;
flex-direction: row;
gap: 1rem;
padding: 1rem;
text-align: center;
/* overflow-y: auto; */
/* height: 500px; */
}
.leftSideBar_favorite-list li {
border: 1px solid black;
border-radius: 4px;
background-color: #523a28;
padding: 1rem;
padding: .5rem;
font-size: 1.6rem;
border-radius: 4px;
transition: background-color 0.3s;
margin: auto;
}

/* Buttons */
Expand Down
25 changes: 25 additions & 0 deletions src/components/LoadingSpinner/Spinner.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import './spinner.css'
export default function Spinner() {
return (
<div className='center'>
<svg
aria-hidden="true"
viewBox="0 0 200 201"
width={50}
height={50}
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#5A3A31"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="#5A3A31"
/>
</svg>
<span className="sr-only">Loading...</span>
</div>
)
}
33 changes: 33 additions & 0 deletions src/components/LoadingSpinner/spinner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.spinner {
width: 2rem;
height: 2rem;
animation: spin 1s linear infinite;
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

.sr-only{
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}

.center{
display: flex;
justify-content: center;
align-items: center;
flex: 1;
}
56 changes: 29 additions & 27 deletions src/components/ReviewList/ReviewList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const ReviewList = (props) => {
const [ratings, setRatings] = useState({})
const [comment, setComment] = useState('')

console.log(ratings)

console.log(ratings, 'I am ratings')

const handleMouseOver = (category, value) => {
setRatings((prev) => ({
Expand Down Expand Up @@ -49,8 +50,7 @@ const ReviewList = (props) => {

}
}
console.log(newRatings)


const reviewData = {
companyId,
position,
Expand Down Expand Up @@ -99,30 +99,32 @@ const ReviewList = (props) => {
<div className="review_list_rating-section">
{Object.entries(categories).map(([category, caption]) => (
<div key={category} className="review_list_rating-category">
<label>{category.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, str => str.toUpperCase())}:</label>
<p className="review_list_sub-caption">{caption}</p>
<div className="review_list_star-rating">
{[1, 2, 3, 4, 5].map((value) => (
<img
key={value}
src={
value <=
(ratings[`${category}-hover`] ||
ratings[category])
? './img/star-yellow.png'
: './img/star-white-transp.png'
}
alt="star"
className="review_list_star"
onMouseOver={() =>
handleMouseOver(category, value)
}
onMouseLeave={() =>
handleMouseLeave(category)
}
onClick={() => handleClick(category, value)}
/>
))}
<div className="star_wrapper">
<label>{category.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, str => str.toUpperCase())}:</label>
<p className="review_list_sub-caption">{caption}</p>
<div className="review_list_star-rating">
{[1, 2, 3, 4, 5].map((value) => (
<img
key={value}
src={
value <=
(ratings[`${category}-hover`] ||
ratings[category])
? './img/star-yellow.png'
: './img/star-white-transp.png'
}
alt="star"
className="review_list_star"
onMouseOver={() =>
handleMouseOver(category, value)
}
onMouseLeave={() =>
handleMouseLeave(category)
}
onClick={() => handleClick(category, value)}
/>
))}
</div>
</div>
</div>
))}
Expand Down
30 changes: 23 additions & 7 deletions src/components/ReviewList/reviewList.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,26 @@
background-color: #EEC170;
}

.rating-category{
margin: 1rem 0;
border: 0.5px solid #444;
border-radius: 2px;
padding: 0 1rem
}

/* Star ratings */
.review_list_rating-section {
margin-bottom: 1rem;
}



/* Container for 5 stars + number rating */
.review_list_star-rating {
margin-top: 7px;
display: flex;
align-items: center;
justify-content: center;
/* align-items: center; */
/* justify-content: center; */
gap: 0.5rem;
margin-bottom: 1rem;
}
Expand All @@ -46,6 +56,7 @@
cursor: pointer;
opacity: 1;
transition: opacity 0.3s;
font-size: 1.5rem;
}

/* change to filled yellow star when clicked/hovered */
Expand All @@ -58,20 +69,25 @@
margin-left: 0.5rem;
font-weight: bold;
min-width: 1ch;
text-align: center;
/* text-align: center; */
display: inline-block;
}
.review_list_sub-caption {
font-size: 11px;
color: lightgray;
text-align: left;
}

.review_list_rating-category{
display: flex;
flex-direction:column;
align-items: center;
justify-content: center;
/* flex-direction:column; */
/* align-items: center; */
/* justify-content: center; */
border: 1px solid #573f2e;
border-radius: 2px;
padding: 0 1rem;
margin: 1rem
}
/* .review_list_rating-category label{

} */
} */
6 changes: 5 additions & 1 deletion src/pages/Company/company.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
#overview {
background-color: #896346;
}

#overview > div {
margin-top: 10px;
}
.content-box div h3{
color:#313030;
}
.content-box div span{
color:#d2d1cf;
color:white;
font-size: 1.3rem;
}
#reviews{
Expand Down
15 changes: 11 additions & 4 deletions src/pages/Profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import CompanyReviews from '../../components/CompanyReviews/CompanyReviews.jsx'
import LeftSidebar from '../../components/LeftSidebar/LeftSidebar'
import { useUser } from '@clerk/clerk-react'
import { useEffect, useState } from 'react'
import Spinner from '../../components/LoadingSpinner/Spinner.jsx'

function Profile() {
const { isLoaded, user } = useUser()
Expand Down Expand Up @@ -37,18 +38,23 @@ function Profile() {
}, [])

if (!isLoaded || !user) {
return <div>....Loading</div> //make this look pretty like a loading bar or something
return <Spinner />
}

return (
<main className="profile_profile-container">
<ProfileInfo userImage={userImage} userName={userName} />

<div className="profile_top">
<div className="profile_info">
<ProfileInfo userImage={userImage} userName={userName} />
</div>
<div className="left_sidebar">
<LeftSidebar />
</div>
</div>
<h3 className="profile_center">
Reviews You have Left (Only Visible to You)
</h3>
<section className="profile_reviews">
<LeftSidebar />
{userReviews.map((review, index) => (
<CompanyReviews
key={`userCompanyReview${index}`}
Expand All @@ -59,6 +65,7 @@ function Profile() {
</section>
</main>
)

}

export default Profile
20 changes: 19 additions & 1 deletion src/pages/Profile/profile.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
.profile_top{
display: flex;
}

.profile_info{
width: 30%;
min-width: 300px;
}

.left_sidebar{
min-width: 150px;
margin-top: 10px;
/* margin-left: auto; */
/* margin-right: auto; */
}

.profile_reviews {
display: grid;
grid-template-columns: 1fr 1fr;
Expand All @@ -18,4 +34,6 @@
.profile_center{
text-align: center;
color:#292929;
}
margin: 10px;
margin-top: 25px;
}
Loading
Loading