-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add banner info * Move PageTitleContainer into PageLayout * Move CompetitionPage into own component * Add style to <p> in Markdown component * Move BannerContainer into PayeLayout * fix after review --------- Co-authored-by: matushl <[email protected]>
- Loading branch information
Showing
16 changed files
with
212 additions
and
155 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import {useRouter} from 'next/router' | ||
import {FC, Fragment} from 'react' | ||
|
||
import {Link} from '@/components/Clickable/Clickable' | ||
import {Competition, Event} from '@/types/api/competition' | ||
import {BannerContainer} from '@/utils/BannerContainer' | ||
import {formatDate} from '@/utils/formatDate' | ||
|
||
import styles from './competition.module.scss' | ||
|
||
type OurCompetition = Omit<Competition, 'history_events'> & {history_events: Event[]} | ||
|
||
type CompetitionPageProps = { | ||
competition: OurCompetition | ||
} | ||
|
||
export const CompetitionPage: FC<CompetitionPageProps> = ({ | ||
competition: {name, who_can_participate, description, upcoming_or_current_event, competition_type, history_events}, | ||
}) => { | ||
const {setBannerText} = BannerContainer.useContainer() | ||
|
||
const startDate = upcoming_or_current_event ? formatDate(upcoming_or_current_event.start) : null | ||
const endDate = upcoming_or_current_event ? formatDate(upcoming_or_current_event.end) : null | ||
setBannerText(startDate ? `${name} sa bude konať ${startDate}` : '') | ||
|
||
const router = useRouter() | ||
const rulesLink = `${router.asPath}/pravidla` | ||
|
||
return ( | ||
<> | ||
<div className={styles.mainText}> | ||
{who_can_participate && <p>Pre koho? {who_can_participate}</p>} | ||
<p>{description}</p> | ||
</div> | ||
<div className={styles.mainText}> | ||
{upcoming_or_current_event ? ( | ||
<div className={styles.mainText}> | ||
<p> | ||
<b>Nadchádzajúci ročník:</b> | ||
</p> | ||
{startDate && <p>Odkedy? {startDate} </p>} | ||
{endDate && <p>Dokedy? {endDate}</p>} | ||
{upcoming_or_current_event.publication_set.length > 0 && ( | ||
<p> | ||
<Link href={`/api/${upcoming_or_current_event.publication_set[0].file}`}>Pozvánka</Link> | ||
</p> | ||
)} | ||
{upcoming_or_current_event.registration_link && ( | ||
<div> | ||
<p> | ||
Registrácia prebieha do: | ||
{upcoming_or_current_event.registration_link.end} | ||
<Link href={upcoming_or_current_event.registration_link.url}>Registračný formulár</Link> | ||
</p> | ||
|
||
<p>{upcoming_or_current_event.registration_link.additional_info}</p> | ||
</div> | ||
)} | ||
</div> | ||
) : ( | ||
<p> | ||
<b>Nadchádzajúci ročník:</b> Pripravujeme | ||
</p> | ||
)} | ||
</div> | ||
|
||
<div className={styles.container}> | ||
<div className={styles.actions}> | ||
<div className={styles.actionButton}> | ||
<Link href={rulesLink}>Pravidlá</Link> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className={styles.h2}> | ||
<h2>Archív: </h2> | ||
</div> | ||
{/* TODO: asi zjednotit styly, neriesit with/without publications */} | ||
{competition_type?.name === 'Tábor' ? ( | ||
<div className={styles.archiveWithoutPublications}> | ||
{history_events.map((event) => ( | ||
<Fragment key={event.id}> | ||
<div> | ||
{name + ' '} {event.school_year} | ||
</div> | ||
</Fragment> | ||
))} | ||
</div> | ||
) : ( | ||
<div className={styles.archiveWithPublications}> | ||
{history_events.map((event) => ( | ||
<Fragment key={event.id}> | ||
<div> | ||
{name} {event.school_year} | ||
</div> | ||
{event.publication_set.map((publication) => ( | ||
<Link key={publication.id} href={`/api/${publication.file}`}> | ||
{publication.name} | ||
</Link> | ||
))} | ||
</Fragment> | ||
))} | ||
</div> | ||
)} | ||
</> | ||
) | ||
} |
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,17 @@ | ||
import {FC} from 'react' | ||
|
||
import {Markdown} from '@/components/StaticSites/Markdown' | ||
import {Competition} from '@/types/api/generated/competition' | ||
import {BannerContainer} from '@/utils/BannerContainer' | ||
import {formatDate} from '@/utils/formatDate' | ||
|
||
type RulesPageProps = Pick<Competition, 'rules' | 'upcoming_or_current_event' | 'name'> | ||
|
||
export const RulesPage: FC<RulesPageProps> = ({name, rules, upcoming_or_current_event}) => { | ||
const {setBannerText} = BannerContainer.useContainer() | ||
|
||
const startDate = formatDate(upcoming_or_current_event?.start) | ||
setBannerText(upcoming_or_current_event ? `${name} sa bude konať ${startDate}` : '') | ||
|
||
return <Markdown content={rules ?? ''} /> | ||
} |
1 change: 0 additions & 1 deletion
1
...pages/strom/akcie/competition.module.scss → ...s/CompetitionPage/competition.module.scss
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.mainText{ | ||
>p{ | ||
padding: 20px; | ||
width: 1000px; | ||
} | ||
} | ||
|
||
|
File renamed without changes.
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
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
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 |
---|---|---|
|
@@ -12,4 +12,8 @@ | |
font-weight: bold; | ||
font-style: italic; | ||
text-transform: uppercase; | ||
} | ||
|
||
.p { | ||
margin: 1rem 0; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export type Styles = { | ||
p: string | ||
table: string | ||
td: string | ||
th: string | ||
|
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
Oops, something went wrong.