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

[WV-522]Updated ChallengeHeaderSimple.jsx with custom padding for JoinedAndDa… #4144

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
14 changes: 8 additions & 6 deletions src/js/common/components/Challenge/JoinedAndDaysLeft.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import DesignTokenColors from '../Style/DesignTokenColors';

const ChallengeParticipantFirstRetrieveController = React.lazy(() => import(/* webpackChunkName: 'ChallengeParticipantFirstRetrieveController' */ '../ChallengeParticipant/ChallengeParticipantFirstRetrieveController'));

function JoinedAndDaysLeft ({ challengeWeVoteId, borderSwitcher }) {
function JoinedAndDaysLeft ({ challengeWeVoteId, borderSwitcher, padding }) {
// eslint-disable-next-line no-unused-vars
const [daysLeft, setDaysLeft] = React.useState(0);
const [voterIsChallengeParticipant, setVoterIsChallengeParticipant] = React.useState(false);
Expand All @@ -31,7 +31,7 @@ function JoinedAndDaysLeft ({ challengeWeVoteId, borderSwitcher }) {
return (
<InfoWrapper>
{/* SVG, Joined, Dot, and Days Left */}
<JoinedInfoWrapper borderSwitcher={borderSwitcher}>
<JoinedInfoWrapper borderSwitcher={borderSwitcher} padding={padding}>
{voterIsChallengeParticipant ? (
<>
<JoinedIcon src={JoinedGreenCircle} alt="Joined" />
Expand All @@ -56,9 +56,11 @@ function JoinedAndDaysLeft ({ challengeWeVoteId, borderSwitcher }) {
JoinedAndDaysLeft.propTypes = {
challengeWeVoteId: PropTypes.string.isRequired,
borderSwitcher: PropTypes.bool,
padding: PropTypes.string,
};
JoinedAndDaysLeft.defaultProps = {
borderSwitcher: true, // Default true shows border around the joined and days left info
borderSwitcher: true, // Default true shows border around the joined and days left info
padding: '5px 10px', // Default padding
};

// Styled Components
Expand All @@ -76,16 +78,16 @@ const InfoWrapper = styled('div')`
`;

const JoinedInfoWrapper = styled('div', {
shouldForwardProp: (prop) => !['borderSwitcher'].includes(prop),
})(({ borderSwitcher }) => `
shouldForwardProp: (prop) => !['borderSwitcher', 'padding'].includes(prop),
})(({ borderSwitcher, padding }) => `
align-items: center;
background-color: ${DesignTokenColors.whiteUI};
border: ${borderSwitcher ? `1px solid ${DesignTokenColors.neutral100}` : 'none'};
border-radius: 20px;
display: flex;
height: auto;
justify-content: center;
padding: 5px 10px;
padding: ${padding};
width: auto;
`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function ChallengeHeaderSimple (props) {
</ChallengeNameH4>
{/* Joined and Days Left Info */}
<JoinedAndDaysLeft borderSwitcher={false}
padding="5px 0"
challengeWeVoteId={challengeWeVoteId}
goToChallengeHome={goToChallengeHome}
/>
Expand Down
Loading