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

Actualiza el enlace del nuevo plan de Perú Libre #347

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open
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
29 changes: 27 additions & 2 deletions components/PresidentialList/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as Styled from './styles';
import useSWR from 'swr';
import fetch from 'isomorphic-fetch';
import Image from 'next/image';
import toggleSlug from 'components/PartyCard/toggleSlug';
import Router, { useRouter } from 'next/router';
import Loading from 'components/Loading';
import GoBackButton from 'components/GoBackButton';
import comesFromAFinishedPresidentialUserTrip from './comesFromAFinishedPresidentialUserTrip';
import ExternalLinkIcon from 'public/images/icons/external-link.svg';

const LoadingScreen = () => {
return (
Expand Down Expand Up @@ -47,6 +47,30 @@ export default function presidentList(props) {
}
const presidentList = data?.data;

const FollowIcon = () => {
return (
<Styled.FollowIcon>
<Image src="/images/icons/follow-icon.svg" width={6} height={12} />
</Styled.FollowIcon>
);
};
const NewPlan = () => {
if (presidentList.president.org_politica_alias === 'Perú Libre') {
return (
<Styled.ExternalLink
href={'https://perulibre.pe/plan-bicentenario.pdf'}
target="_blank"
rel="noopener noreferrer">
<Styled.ExternalLinkText>
Ir al <strong>nuevo</strong> plan de gobierno
</Styled.ExternalLinkText>
<FollowIcon />
</Styled.ExternalLink>
);
}
return null;
};

return (
<Styled.Container>
<Styled.Header />
Expand All @@ -65,14 +89,15 @@ export default function presidentList(props) {
<Styled.EmphasizedTitle>
{presidentList.president.org_politica_alias}
</Styled.EmphasizedTitle>
<NewPlan />
<Styled.ExternalLink
href={presidentList.president.plan_de_gobierno_url || '#'}
target="_blank"
rel="noopener noreferrer">
<ExternalLinkIcon />
<Styled.ExternalLinkText>
Ir al plan de gobierno
</Styled.ExternalLinkText>
<FollowIcon />
</Styled.ExternalLink>
<Styled.CandidateSingle>
<Styled.Subtitle>
Expand Down
10 changes: 8 additions & 2 deletions components/PresidentialList/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,28 @@ export const Title = styled(BaseTitle)`

export const EmphasizedTitle = styled(Title)`
color: #5bc13e;
margin-bottom: 0.5rem;
margin-top: 0;
`;

export const ExternalLink = styled('a')`
align-items: center;
align-self: flex-start;
align-self: center;
color: #5bc13e;
display: flex;
font-size: 0.875rem;
margin-top: 1rem;
margin-top: 0.5rem;
padding: 0.5625rem 0;
`;
export const ExternalLinkText = styled('span')`
font-size: 0.875rem;
margin-left: 0.5rem;
`;

export const FollowIcon = styled.div`
margin-left: 0.625rem;
`;

export const Subtitle = styled('p')`
color: #475065;
font-family: Poppins;
Expand Down
1 change: 1 addition & 0 deletions public/images/icons/follow-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.