Skip to content

Commit fdce069

Browse files
tindevwviljeno
andcommitted
Fix comment
Co-authored-by: viljeno <[email protected]>
1 parent b5f616b commit fdce069

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lego-webapp/components/ShareButton/index.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ type Props = {
1111
const ShareButton: React.FC<Props> = ({ title, url }) => {
1212
const dispatch = useAppDispatch();
1313
const handleShare = async () => {
14-
if (navigator.share) {
15-
try {
16-
await navigator.share({ title, url });
17-
} catch (error) {
18-
console.error('Kunne ikke dele:', error);
19-
}
14+
if (navigator?.canShare?.({ title, url })) {
15+
navigator.share({ title, url });
2016
} else {
2117
{
2218
navigator.clipboard.writeText(url);
@@ -25,16 +21,16 @@ const ShareButton: React.FC<Props> = ({ title, url }) => {
2521
addToast({
2622
message: 'Link er kopiert til utklippstavlen',
2723
type: 'success',
28-
dismissAfter: 10000,
2924
}),
3025
);
3126
}
3227
};
3328

3429
return (
3530
<Button onPress={handleShare}>
36-
<Flex justifyContent="center">
37-
<Icon name="share" iconNode={<ShareIcon />} size={20} />
31+
<Flex justifyContent="center" gap="var(--spacing-sm)">
32+
<Icon iconNode={<ShareIcon />} size={20} />
33+
{title}
3834
</Flex>
3935
</Button>
4036
);

lego-webapp/pages/events/@eventIdOrSlug/+Page.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,10 @@ const EventDetail = () => {
309309

310310
<Line />
311311

312-
{loggedIn && (
313-
<ShareButton
314-
title={event?.title || 'Sjekk ut dette arrangementet!'}
315-
url={`${appConfig?.webUrl}/events/${event?.id}`}
316-
/>
317-
)}
312+
<ShareButton
313+
title={'Del arrangement'}
314+
url={`${appConfig?.webUrl}/events/${event?.id}`}
315+
/>
318316

319317
{(actionGrant.includes('edit') || actionGrant.includes('delete')) && (
320318
<Line />

lego-webapp/pages/joblistings/@joblistingIdOrSlug/+Page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import DisplayContent from '~/components/DisplayContent';
1212
import InfoList from '~/components/InfoList';
1313
import { jobType, Year, Workplaces } from '~/components/JoblistingItem/Items';
1414
import PropertyHelmet from '~/components/PropertyHelmet';
15+
import ShareButton from '~/components/ShareButton';
1516
import Time from '~/components/Time';
1617
import YoutubeCover from '~/pages/pages/_components/YoutubeCover';
1718
import { fetchJoblisting } from '~/redux/actions/JoblistingActions';
@@ -187,6 +188,11 @@ const JoblistingDetail = () => {
187188
</LinkButton>
188189
)}
189190

191+
<ShareButton
192+
title={'Del jobbannonse'}
193+
url={`${appConfig?.webUrl}/joblistings/${joblisting?.id}`}
194+
/>
195+
190196
{(joblisting.responsible || joblisting.contactMail) && (
191197
<div>
192198
<h3>Kontaktinfo</h3>

0 commit comments

Comments
 (0)