Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
margin: 0 auto;
@media (max-width: breakpoint(md)) {
font: var(--font-sw-l);
padding: 10px 1em;
text-align: left;
}
}

Expand All @@ -99,6 +101,8 @@
margin: 0 auto;
@media (max-width: breakpoint(md)) {
font: var(--font-sw-m);
padding: 10px 1em;
text-align: left;
}
}

Expand All @@ -108,14 +112,13 @@
line-height: 28px;
padding: 10px 5em;
text-align: left;
width: 80%;
width: 100%;
white-space: pre-line;
}

@media (max-width: breakpoint(md)) {
.text {
padding: 10px 1em;
width: 98%;
}
}

Expand Down Expand Up @@ -158,15 +161,25 @@
padding: 0 40px 20px 40px;
width: 100%;
gap: 16px;
@media (max-width: breakpoint(md)) {
justify-content: flex-start;
padding: 10px 1em;
flex-direction: column;
align-items: flex-start;
gap: 4px
}
}

.shareButton {
color: var(--primary-color);
display: flex;
align-items: center;
align-self: flex-start;
padding: 0 5em;
padding: 0 5em;
margin-top: 16px;
@media (max-width: breakpoint(md)) {
padding: 0 1em;
}
}

.author {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,38 @@ import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button';
import chevronleft from '@/shared/assets/icons/ChevronLeftBlack.svg';
import chevronright from '@/shared/assets/icons/ChevronRightBlack.svg';
import { useRouter, useParams } from 'next/navigation';
import { linkify } from '@/shared/ui/v2/Chatbot/utils/linkify';
import { useClientTranslation } from '@/shared/i18n';
import { NewsCard } from '@/widgets/NewsCard';
import { ShareButton } from '@/shared/ui/v2/ShareButton';

type HeroImageProps = {
picture?: string;
};

const HeroImage = ({ picture }: HeroImageProps) => {
if (!picture) return <div className={cls.noImageContainer} />;

return (
<div className={cls.imageContainer}>
<Image
src={picture}
alt=""
className={cls.imageBlur}
width={100}
height={600}
/>
<Image
src={picture}
alt=""
className={cls.image}
width={100}
height={600}
/>
</div>
);
};

const NewsElementPage = () => {
useScrollToTop();
const params = useParams();
Expand All @@ -45,6 +73,9 @@ const NewsElementPage = () => {
const picture = post.titlePicture?.id
? `${directusBaseUrl}/assets/${post.titlePicture.id}`
: undefined;

const bodyHtml = linkify(post?.bodyText ?? '');

return (
<Container>
<div className={cls.navButtons}>
Expand Down Expand Up @@ -84,26 +115,7 @@ const NewsElementPage = () => {
</Button>
</div>
<div className={classNames(cls.NewsElementPage)}>
{picture ? (
<div className={cls.imageContainer}>
<Image
src={picture}
alt={''}
className={cls.imageBlur}
width={100}
height={600}
/>
<Image
src={picture}
alt={''}
className={cls.image}
width={100}
height={600}
/>
</div>
) : (
<div className={cls.noImageContainer} />
)}
<HeroImage picture={picture} />

<h1 className={cls.title}>{post?.title}</h1>

Expand All @@ -114,7 +126,10 @@ const NewsElementPage = () => {
<span className={cls.date}>{post?.date || 'Date/Time'}</span>
</div>

<p className={cls.text}>{post?.bodyText}</p>
<div
className={cls.text}
dangerouslySetInnerHTML={{ __html: bodyHtml }}
/>

<div className={cls.shareButton}>
<ShareButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export function linkify(text: string): string {
const hrefRaw = url.startsWith('www.') ? `https://${url}` : url;
const href = encodeURI(hrefRaw).replace(/"/g, '&quot;');

return `<a href="${href}" style="color:#121212; text-decoration:underline;">${url}</a>${escapeHtml(trailing)}`;
return `<a href="${href}" target="_blank" rel="noopener noreferrer" style="color:#ffa100; text-decoration:none;">${url}</a>${escapeHtml(trailing)}`;
});
}