generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #503 from ita-social-projects/#502MiniComponents
StarForLike, CategoryBadges
- Loading branch information
Showing
7 changed files
with
99 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,8 +180,3 @@ | |
.company-card__buttons:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.star { | ||
color: #ffd800; | ||
font-size: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Badge } from 'antd'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function CategoryBadges({ categories }) { | ||
const style = { | ||
backgroundColor: '#1F9A7C', | ||
fontWeight: 600, | ||
fontFamily: 'Inter', | ||
fontSize: 10, | ||
margin: 5, | ||
}; | ||
return ( | ||
<div> | ||
{categories | ||
? categories.map((category) => ( | ||
<Badge | ||
title="" | ||
key={category.id} | ||
size="medium" | ||
count={category.name.toUpperCase()} | ||
style={style} | ||
/> | ||
)) | ||
: null} | ||
</div> | ||
); | ||
} | ||
|
||
CategoryBadges.propTypes = { | ||
categories: PropTypes.array, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { StarOutlined, StarFilled } from '@ant-design/icons'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import styles from './StarForLike.module.css'; | ||
|
||
export default function StarForLike({ | ||
isSaved, | ||
isAuthorized, | ||
ownProfile, | ||
handleClick, | ||
}) { | ||
const filledStar = ( | ||
<StarFilled | ||
className={styles['star']} | ||
onClick={handleClick} | ||
data-testid="star" | ||
/> | ||
); | ||
const outlinedStar = ( | ||
<StarOutlined | ||
className={styles['star']} | ||
onClick={handleClick} | ||
data-testid="emptystar" | ||
/> | ||
); | ||
return isAuthorized && !ownProfile | ||
? isSaved | ||
? filledStar | ||
: outlinedStar | ||
: null; | ||
} | ||
|
||
StarForLike.propTypes = { | ||
isSaved: PropTypes.bool, | ||
isAuthorized: PropTypes.bool, | ||
ownProfile: PropTypes.bool, | ||
handleClick: PropTypes.func, | ||
}; |
4 changes: 4 additions & 0 deletions
4
FrontEnd/src/components/MiniComponents/StarForLike.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.star { | ||
color: #ffd800; | ||
font-size: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters