From b799e4efc68bc302c1f094dbad7d9243fd611913 Mon Sep 17 00:00:00 2001 From: rtrembecky Date: Fri, 10 Nov 2023 13:05:53 +0100 Subject: [PATCH 1/2] otvorit PDF nahrateho/opraveneho riesenia v novom tabe --- src/components/Clickable/Clickable.tsx | 10 +++++----- src/components/Problems/Problems.tsx | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/Clickable/Clickable.tsx b/src/components/Clickable/Clickable.tsx index 009445e6..86503fbf 100644 --- a/src/components/Clickable/Clickable.tsx +++ b/src/components/Clickable/Clickable.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx' import NextLink from 'next/link' -import {ButtonHTMLAttributes, FC, ReactNode} from 'react' +import {ButtonHTMLAttributes, ComponentProps, FC, ReactNode} from 'react' import styles from './Clickable.module.scss' @@ -24,20 +24,20 @@ export const Button: FC = ({children, onClick, disabled, type}) => ) } -interface LinkProps { +type LinkProps = { href?: string disabled?: boolean children: ReactNode -} +} & Pick, 'target'> -export const Link: FC = ({children, href, disabled}) => { +export const Link: FC = ({children, href, disabled, target}) => { // https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link return disabled ? ( {children} ) : ( - + {children} ) diff --git a/src/components/Problems/Problems.tsx b/src/components/Problems/Problems.tsx index ff19a4db..c5f801b5 100644 --- a/src/components/Problems/Problems.tsx +++ b/src/components/Problems/Problems.tsx @@ -75,11 +75,16 @@ const Problem: FC<{ {problem.solution_pdf && vzorové riešenie} {registered && ( <> - + moje riešenie opravené riešenie{!!problem.submitted?.corrected_solution && ` (${problem.submitted.score || '?'})`} From 1b57098c6751ba72a3106cc4046a8e75b96e24c3 Mon Sep 17 00:00:00 2001 From: rtrembecky Date: Fri, 10 Nov 2023 17:05:13 +0100 Subject: [PATCH 2/2] open rest of the PDF links in a new tab --- src/components/Archive/Archive.tsx | 6 +++++- src/components/Problems/Problems.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/Archive/Archive.tsx b/src/components/Archive/Archive.tsx index efc846e9..c6a1ddb5 100644 --- a/src/components/Archive/Archive.tsx +++ b/src/components/Archive/Archive.tsx @@ -23,7 +23,11 @@ const PublicationButton: FC<{ publicationId: number publicationName: string }> = ({publicationId, publicationName}) => { - return {publicationName} + return ( + + {publicationName} + + ) } const ResultsButton: FC<{ diff --git a/src/components/Problems/Problems.tsx b/src/components/Problems/Problems.tsx index c5f801b5..d6308fea 100644 --- a/src/components/Problems/Problems.tsx +++ b/src/components/Problems/Problems.tsx @@ -72,7 +72,11 @@ const Problem: FC<{ )} {displayActions && (
- {problem.solution_pdf && vzorové riešenie} + {problem.solution_pdf && ( + + vzorové riešenie + + )} {registered && ( <>