Skip to content

Commit

Permalink
feat: share modal ui done
Browse files Browse the repository at this point in the history
  • Loading branch information
g-saracca committed Nov 20, 2024
1 parent 63a307f commit 22f8b3e
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/sections/collection/share-button/ShareButton.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@import 'node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module';

.share-icon {
margin-right: 0.3rem;
margin-bottom: 0.2rem;
}

// Modal styles

.help-block {
color: $dv-subtext-color;
font-size: 14px;
}

.social-btn {
display: grid;
place-items: center;
padding: 8px 12px;
background-color: transparent;
border: 0;
border-radius: 6px;
transition: all 0.15s ease-in-out;

&:hover {
scale: 1.1;
box-shadow: 2px 2px 10px rgb(0 0 0 / 30%);
}

&:active {
scale: 1;
box-shadow: none;
}

&.fb {
background-color: #3a5795;

svg {
color: #fff;
}
}

&.x {
background-color: #000;

svg {
color: #fff;
}
}

&.linkedin {
background-color: #6f5499;

svg {
color: #fff;
}
}
}
28 changes: 28 additions & 0 deletions src/sections/collection/share-button/ShareButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useState } from 'react'
import { Button, Tooltip } from '@iqss/dataverse-design-system'
import { ShareFill } from 'react-bootstrap-icons'
import { ShareModal } from './ShareModal'
import styles from './ShareButton.module.scss'

export const ShareButton = () => {
const [showShareModal, setShowShareModal] = useState(false)

const openShareModal = () => setShowShareModal(true)
const closeShareModal = () => setShowShareModal(false)

return (
<>
<Tooltip overlay="Share Collection" placement="top">
<Button
variant="link"
onClick={openShareModal}
className={styles['share-btn']}
icon={<ShareFill className={styles['share-icon']} />}>
Share
</Button>
</Tooltip>

<ShareModal show={showShareModal} handleClose={closeShareModal} />
</>
)
}
52 changes: 52 additions & 0 deletions src/sections/collection/share-button/ShareModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
import styles from './ShareButton.module.scss'

interface ShareModalProps {
show: boolean
handleClose: () => void
}

export const ShareModal = ({ show, handleClose }: ShareModalProps) => {
return (
<Modal show={show} onHide={handleClose} centered>
<Modal.Header>
<Modal.Title>Share Collection</Modal.Title>
</Modal.Header>
<Modal.Body>
<p className={styles['help-block']}>
Share this collection on your favorite social media networks.
</p>

<Stack direction="horizontal">
<button
type="button"
aria-label="LinkedIn"
title="LinkedIn"
className={`${styles['social-btn']} ${styles.linkedin}`}>
<Linkedin size={18} />
</button>
<button
type="button"
aria-label="X, formerly Twitter"
title="X, formerly Twitter"
className={`${styles['social-btn']} ${styles.x}`}>
<TwitterX size={18} />
</button>
<button
type="button"
aria-label="Facebook"
title="Facebook"
className={`${styles['social-btn']} ${styles.fb}`}>
<Facebook size={18} />
</button>
</Stack>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={handleClose} type="submit">
Close
</Button>
</Modal.Footer>
</Modal>
)
}

0 comments on commit 22f8b3e

Please sign in to comment.