File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed
joblistings/@joblistingIdOrSlug Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,8 @@ type Props = {
11
11
const ShareButton : React . FC < Props > = ( { title, url } ) => {
12
12
const dispatch = useAppDispatch ( ) ;
13
13
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 } ) ;
20
16
} else {
21
17
{
22
18
navigator . clipboard . writeText ( url ) ;
@@ -25,16 +21,16 @@ const ShareButton: React.FC<Props> = ({ title, url }) => {
25
21
addToast ( {
26
22
message : 'Link er kopiert til utklippstavlen' ,
27
23
type : 'success' ,
28
- dismissAfter : 10000 ,
29
24
} ) ,
30
25
) ;
31
26
}
32
27
} ;
33
28
34
29
return (
35
30
< 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 }
38
34
</ Flex >
39
35
</ Button >
40
36
) ;
Original file line number Diff line number Diff line change @@ -309,12 +309,10 @@ const EventDetail = () => {
309
309
310
310
< Line />
311
311
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
+ />
318
316
319
317
{ ( actionGrant . includes ( 'edit' ) || actionGrant . includes ( 'delete' ) ) && (
320
318
< Line />
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import DisplayContent from '~/components/DisplayContent';
12
12
import InfoList from '~/components/InfoList' ;
13
13
import { jobType , Year , Workplaces } from '~/components/JoblistingItem/Items' ;
14
14
import PropertyHelmet from '~/components/PropertyHelmet' ;
15
+ import ShareButton from '~/components/ShareButton' ;
15
16
import Time from '~/components/Time' ;
16
17
import YoutubeCover from '~/pages/pages/_components/YoutubeCover' ;
17
18
import { fetchJoblisting } from '~/redux/actions/JoblistingActions' ;
@@ -187,6 +188,11 @@ const JoblistingDetail = () => {
187
188
</ LinkButton >
188
189
) }
189
190
191
+ < ShareButton
192
+ title = { 'Del jobbannonse' }
193
+ url = { `${ appConfig ?. webUrl } /joblistings/${ joblisting ?. id } ` }
194
+ />
195
+
190
196
{ ( joblisting . responsible || joblisting . contactMail ) && (
191
197
< div >
192
198
< h3 > Kontaktinfo</ h3 >
You can’t perform that action at this time.
0 commit comments