Skip to content

Commit

Permalink
reuse component
Browse files Browse the repository at this point in the history
  • Loading branch information
peteranny committed Jan 3, 2025
1 parent 58a4a8f commit 4716d02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Coin from 'common/icons/Coin';
import styles from './InterviewExperiences.module.css';
import { formatCreatedAt, formatSalary, formatSalaryRange } from './helper';
import Rating from './Rating';
import OverallRating from 'common/OverallRating';

const createLinkTo = ({ id, pageType }) => ({
pathname: `/experiences/${id}`,
Expand All @@ -27,6 +28,7 @@ const ExperienceEntry = ({
created_at: createdAt,
salary,
overall_rating: overallRating,
averageSectionRating,
sections: [section],
},
size,
Expand Down Expand Up @@ -60,12 +62,13 @@ const ExperienceEntry = ({
)}
</div>
)}
<div className={styles.rating}>
<div className={styles.label}>
評分:{overallRating.toFixed(1)}
{typeof averageSectionRating !== 'undefined' ? (
<OverallRating rating={averageSectionRating} hasRatingNumber />
) : (
<div className={styles.rating}>
<Rating rate={overallRating} />
</div>
<Rating rate={overallRating} />
</div>
)}
</div>
</div>

Expand Down Expand Up @@ -97,12 +100,13 @@ const ExperienceEntry = ({
ExperienceEntry.propTypes = {
canView: PropTypes.bool.isRequired,
data: PropTypes.shape({
averageSectionRating: PropTypes.number,
created_at: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
job_title: PropTypes.shape({ name: PropTypes.string.isRequired })
.isRequired,
originalCompanyName: PropTypes.string,
overall_rating: PropTypes.number.isRequired,
overall_rating: PropTypes.number,
salary: PropTypes.shape({
amount: PropTypes.number.isRequired,
type: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
}

.rating {
.label {
margin-right: 1em;
}

svg {
cursor: auto;
width: 24px;
Expand Down

0 comments on commit 4716d02

Please sign in to comment.