Skip to content

Commit 22f8b3e

Browse files
committed
feat: share modal ui done
1 parent 63a307f commit 22f8b3e

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@import 'node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module';
2+
3+
.share-icon {
4+
margin-right: 0.3rem;
5+
margin-bottom: 0.2rem;
6+
}
7+
8+
// Modal styles
9+
10+
.help-block {
11+
color: $dv-subtext-color;
12+
font-size: 14px;
13+
}
14+
15+
.social-btn {
16+
display: grid;
17+
place-items: center;
18+
padding: 8px 12px;
19+
background-color: transparent;
20+
border: 0;
21+
border-radius: 6px;
22+
transition: all 0.15s ease-in-out;
23+
24+
&:hover {
25+
scale: 1.1;
26+
box-shadow: 2px 2px 10px rgb(0 0 0 / 30%);
27+
}
28+
29+
&:active {
30+
scale: 1;
31+
box-shadow: none;
32+
}
33+
34+
&.fb {
35+
background-color: #3a5795;
36+
37+
svg {
38+
color: #fff;
39+
}
40+
}
41+
42+
&.x {
43+
background-color: #000;
44+
45+
svg {
46+
color: #fff;
47+
}
48+
}
49+
50+
&.linkedin {
51+
background-color: #6f5499;
52+
53+
svg {
54+
color: #fff;
55+
}
56+
}
57+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { useState } from 'react'
2+
import { Button, Tooltip } from '@iqss/dataverse-design-system'
3+
import { ShareFill } from 'react-bootstrap-icons'
4+
import { ShareModal } from './ShareModal'
5+
import styles from './ShareButton.module.scss'
6+
7+
export const ShareButton = () => {
8+
const [showShareModal, setShowShareModal] = useState(false)
9+
10+
const openShareModal = () => setShowShareModal(true)
11+
const closeShareModal = () => setShowShareModal(false)
12+
13+
return (
14+
<>
15+
<Tooltip overlay="Share Collection" placement="top">
16+
<Button
17+
variant="link"
18+
onClick={openShareModal}
19+
className={styles['share-btn']}
20+
icon={<ShareFill className={styles['share-icon']} />}>
21+
Share
22+
</Button>
23+
</Tooltip>
24+
25+
<ShareModal show={showShareModal} handleClose={closeShareModal} />
26+
</>
27+
)
28+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
2+
import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
3+
import styles from './ShareButton.module.scss'
4+
5+
interface ShareModalProps {
6+
show: boolean
7+
handleClose: () => void
8+
}
9+
10+
export const ShareModal = ({ show, handleClose }: ShareModalProps) => {
11+
return (
12+
<Modal show={show} onHide={handleClose} centered>
13+
<Modal.Header>
14+
<Modal.Title>Share Collection</Modal.Title>
15+
</Modal.Header>
16+
<Modal.Body>
17+
<p className={styles['help-block']}>
18+
Share this collection on your favorite social media networks.
19+
</p>
20+
21+
<Stack direction="horizontal">
22+
<button
23+
type="button"
24+
aria-label="LinkedIn"
25+
title="LinkedIn"
26+
className={`${styles['social-btn']} ${styles.linkedin}`}>
27+
<Linkedin size={18} />
28+
</button>
29+
<button
30+
type="button"
31+
aria-label="X, formerly Twitter"
32+
title="X, formerly Twitter"
33+
className={`${styles['social-btn']} ${styles.x}`}>
34+
<TwitterX size={18} />
35+
</button>
36+
<button
37+
type="button"
38+
aria-label="Facebook"
39+
title="Facebook"
40+
className={`${styles['social-btn']} ${styles.fb}`}>
41+
<Facebook size={18} />
42+
</button>
43+
</Stack>
44+
</Modal.Body>
45+
<Modal.Footer>
46+
<Button variant="secondary" onClick={handleClose} type="submit">
47+
Close
48+
</Button>
49+
</Modal.Footer>
50+
</Modal>
51+
)
52+
}

0 commit comments

Comments
 (0)