feat: gaurko eguna markatzen du
This commit is contained in:
@@ -3,7 +3,7 @@ import { datesUtils } from '../utils/dateUtils';
|
|||||||
import { SFEguna } from '../pages/sanferminak';
|
import { SFEguna } from '../pages/sanferminak';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { rem } from 'polished';
|
import { rem } from 'polished';
|
||||||
import { colors, font, fontWeight, size } from '../ui/theme';
|
import { font, fontWeight, size } from '../ui/theme';
|
||||||
import { graphql, useStaticQuery } from 'gatsby';
|
import { graphql, useStaticQuery } from 'gatsby';
|
||||||
|
|
||||||
interface DataProps {
|
interface DataProps {
|
||||||
@@ -61,7 +61,6 @@ export const SFEgunaEdukia: React.FC<{ sfeguna: SFEguna }> = ({ sfeguna }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const BesteHitzordua = styled.p`
|
const BesteHitzordua = styled.p`
|
||||||
color: ${colors.zuria};
|
|
||||||
${font.base()};
|
${font.base()};
|
||||||
font-weight: ${fontWeight.bold};
|
font-weight: ${fontWeight.bold};
|
||||||
|
|
||||||
@@ -72,21 +71,20 @@ const SFEgunaEguna = styled.p`
|
|||||||
margin-bottom: ${rem(size.base)};
|
margin-bottom: ${rem(size.base)};
|
||||||
|
|
||||||
${font.large()};
|
${font.large()};
|
||||||
color: ${colors.zuria};
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const SFEgunaNagusiaIzenburua = styled.h2`
|
const SFEgunaNagusiaIzenburua = styled.h2`
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
${font.large()};
|
${font.large()};
|
||||||
color: ${colors.zuria};
|
|
||||||
font-weight: ${fontWeight.bold};
|
font-weight: ${fontWeight.bold};
|
||||||
text-align: center;
|
text-align: center;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const SFEgunaNagusiaOrdua = styled.p`
|
const SFEgunaNagusiaOrdua = styled.p`
|
||||||
${font.base()};
|
${font.base()};
|
||||||
color: ${colors.zuria};
|
|
||||||
font-weight: ${fontWeight.bold};
|
font-weight: ${fontWeight.bold};
|
||||||
text-align: center;
|
text-align: center;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { rem } from 'polished';
|
|||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import { Oina } from '../components/Oina';
|
import { Oina } from '../components/Oina';
|
||||||
import { SFEgunaEdukia } from '../components/SFEgunaEdukia';
|
import { SFEgunaEdukia } from '../components/SFEgunaEdukia';
|
||||||
|
import { datesUtils } from '../utils/dateUtils';
|
||||||
|
|
||||||
export interface SFEguna {
|
export interface SFEguna {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -88,7 +89,14 @@ const IndexPage: React.VFC<PageProps> = () => {
|
|||||||
strapiSanferminak.sf_egunak.length > 0 && (
|
strapiSanferminak.sf_egunak.length > 0 && (
|
||||||
<SFEgunZerrenda>
|
<SFEgunZerrenda>
|
||||||
{strapiSanferminak.sf_egunak.map(sfeguna => (
|
{strapiSanferminak.sf_egunak.map(sfeguna => (
|
||||||
<SFEgunaElementua key={sfeguna.id}>
|
<SFEgunaElementua
|
||||||
|
key={sfeguna.id}
|
||||||
|
className={
|
||||||
|
datesUtils.isToday(new Date(sfeguna.eguna))
|
||||||
|
? 'active'
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
>
|
||||||
<SFEgunaEdukia sfeguna={sfeguna} />
|
<SFEgunaEdukia sfeguna={sfeguna} />
|
||||||
</SFEgunaElementua>
|
</SFEgunaElementua>
|
||||||
))}
|
))}
|
||||||
@@ -107,6 +115,23 @@ const SFEgunaElementua = styled.li`
|
|||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: ${colors.beltza};
|
background-color: ${colors.beltza};
|
||||||
|
color: ${colors.zuria};
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
@keyframes mymove {
|
||||||
|
0% {
|
||||||
|
background-color: ${colors.beltza};
|
||||||
|
}
|
||||||
|
33% {
|
||||||
|
background-color: ${colors.morea};
|
||||||
|
}
|
||||||
|
66% {
|
||||||
|
background-color: ${colors.beltza};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
animation: mymove 4s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
${media.tablet`
|
${media.tablet`
|
||||||
aspect-ratio: 1/1;
|
aspect-ratio: 1/1;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export const datesUtils = {
|
|||||||
getDate,
|
getDate,
|
||||||
getHour,
|
getHour,
|
||||||
areSameDay,
|
areSameDay,
|
||||||
|
isToday,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getDate(rawDate: string): Date {
|
function getDate(rawDate: string): Date {
|
||||||
@@ -20,3 +21,7 @@ function getHour(date: Date): string {
|
|||||||
function areSameDay(date: Date, reference: Date): boolean {
|
function areSameDay(date: Date, reference: Date): boolean {
|
||||||
return dayjs(date).isSame(reference, 'day');
|
return dayjs(date).isSame(reference, 'day');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isToday(date: Date) {
|
||||||
|
return dayjs(date).isSame(new Date(), 'day');
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user