Skip to content

Commit

Permalink
Fixed failing build
Browse files Browse the repository at this point in the history
  • Loading branch information
TomPlum committed Oct 3, 2023
1 parent c1b1050 commit ba789a1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
24 changes: 13 additions & 11 deletions src/modules/Newspaper/components/Headline/Headline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ const Headline = ({ headline }: HeadlineProps) => {
const { t } = useTranslation('translation', { keyPrefix: 'newspaper.headline' })

const copy = useCallback(() => {
navigator.clipboard.writeText(headline).then(() => {
fireToast({
type: 'success',
timeout: 2000,
message: t('copy.success')
if (typeof headline === 'string') {
navigator.clipboard.writeText(headline).then(() => {
fireToast({
type: 'success',
timeout: 2000,
message: t('copy.success')
})
}).catch(() => {
fireToast({
type: 'error',
message: t('copy.error')
})
})
}).catch(() => {
fireToast({
type: 'error',
message: t('copy.error')
})
})
}
}, [fireToast, headline, t])

return (
Expand Down
10 changes: 8 additions & 2 deletions src/views/HomeView/HomeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ const HomeView = () => {

<Grid container spacing={{ xs: 4, md: 8 }} columns={12} sx={{ flexGrow: 1 }}>
<Grid xs={12} lg={6} sx={{ borderRight: "1px solid black" }} className={styles.typeArticle}>
<NewspaperArticle className={styles.article} />
<NewspaperArticle
className={styles.article}
onClick={() => navigate('/newspaper')}
/>
</Grid>

<Grid xs={12} lg={6} className={styles.typeArticle}>
<CardsArticle className={styles.article} />
<CardsArticle
className={styles.article}
onClick={() => navigate('/articles')}
/>
</Grid>
</Grid>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/views/HomeView/components/CardsArticle/CardsArticle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { CardsArticleProps } from "views/HomeView/components/CardsArticle/types.
import classNames from "classnames"
import styles from './CardsArticle.module.scss'

const CardsArticle = ({ className }: CardsArticleProps) => {
const CardsArticle = ({ className, onClick }: CardsArticleProps) => {
const { t } = useTranslation('translation', { keyPrefix: 'views.home.articles.cards' })

return (
<div data-testid='home-newspaper-article' className={classNames(styles.wrapper, className)}>
<div data-testid='home-newspaper-article' className={classNames(styles.wrapper, className)} onClick={onClick}>
<img src={cardsAnimation} alt='cards'/>

<Typography>
Expand Down
1 change: 1 addition & 0 deletions src/views/HomeView/components/CardsArticle/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export interface CardsArticleProps {
className?: string
onClick: () => void
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { NewspaperArticleProps } from "views/HomeView/components/NewspaperArticl
import classNames from "classnames"
import Typography from "components/Typography"

const NewspaperArticle = ({ className }: NewspaperArticleProps) => {
const NewspaperArticle = ({ className, onClick }: NewspaperArticleProps) => {
const { t } = useTranslation('translation', { keyPrefix: 'views.home.articles.newspaper' })

return (
<div data-testid='home-newspaper-article' className={classNames(styles.wrapper, className)}>
<div data-testid='home-newspaper-article' className={classNames(styles.wrapper, className)} onClick={onClick}>
<img src={newspaperAnimation} />

<Typography>
Expand Down
1 change: 1 addition & 0 deletions src/views/HomeView/components/NewspaperArticle/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export interface NewspaperArticleProps {
className?: string
onClick: () => void
}

0 comments on commit ba789a1

Please sign in to comment.