-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: APP-189 post secret link (#2401)
- Loading branch information
Showing
16 changed files
with
257 additions
and
185 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
web-components/src/components/buttons/PostAdminButton/PostAdminButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { StoryObj } from '@storybook/react'; | ||
|
||
import { PostAdminButton } from './PostAdminButton'; | ||
|
||
type Story = StoryObj<typeof PostAdminButton>; | ||
|
||
export default { | ||
title: 'Buttons/PostAdminButton', | ||
component: PostAdminButton, | ||
argTypes: { | ||
sharePublicLink: { action: 'share public link' }, | ||
sharePrivateLink: { action: 'share private link' }, | ||
}, | ||
}; | ||
|
||
export const Public: Story = { | ||
args: { | ||
publicPost: true, | ||
}, | ||
}; | ||
|
||
export const Private: Story = { | ||
args: { | ||
publicPost: false, | ||
}, | ||
}; |
80 changes: 80 additions & 0 deletions
80
web-components/src/components/buttons/PostAdminButton/PostAdminButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React, { useState } from 'react'; | ||
import { Menu } from '@mui/material'; | ||
|
||
import { | ||
SharePrivateMenuItem, | ||
SharePublicMenuItem, | ||
} from '../../cards/PostCard/PostCard.MenuItems'; | ||
import { HorizontalDotsIcon } from '../../icons/HorizontalDotsIcon'; | ||
|
||
type Props = { | ||
publicPost?: boolean; | ||
sharePublicLink: (ev: React.MouseEvent) => void; | ||
sharePrivateLink: (ev: React.MouseEvent) => void; | ||
}; | ||
|
||
export const PostAdminButton = ({ | ||
publicPost, | ||
sharePublicLink, | ||
sharePrivateLink, | ||
}: Props) => { | ||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); | ||
const open = Boolean(anchorEl); | ||
const handleClick = (event: React.MouseEvent<HTMLDivElement>) => { | ||
event.stopPropagation(); | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
const handleClose = (event: React.MouseEvent<HTMLDivElement>) => { | ||
event.stopPropagation(); | ||
setAnchorEl(null); | ||
}; | ||
return ( | ||
<> | ||
<div | ||
id="actions-button" | ||
aria-controls={open ? 'actions-menu' : undefined} | ||
aria-haspopup="true" | ||
aria-expanded={open ? 'true' : undefined} | ||
onClick={handleClick} | ||
className="flex items-center justify-center w-[44px] h-[44px] rounded-[50%] bg-grey-700 cursor-pointer opacity-80 hover:opacity-60" | ||
> | ||
<HorizontalDotsIcon className="text-grey-0 h-[24px] w-[24px]" /> | ||
</div> | ||
<Menu | ||
anchorOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'right', | ||
}} | ||
transformOrigin={{ | ||
vertical: 'top', | ||
horizontal: 'right', | ||
}} | ||
id="actions-menu" | ||
anchorEl={anchorEl} | ||
open={open} | ||
onClose={handleClose} | ||
MenuListProps={{ | ||
'aria-labelledby': 'actions-button', | ||
}} | ||
classes={{ | ||
paper: | ||
'rounded-sm py-10 border border-solid border-grey-300 shadow-[0_0_4px_0_rgba(0,0,0,0.05)]', | ||
}} | ||
> | ||
{/* <EditMenuItem /> */} | ||
<SharePublicMenuItem | ||
classes={{ root: 'px-[25px]' }} | ||
onClick={sharePublicLink} | ||
publicPost={publicPost} | ||
/> | ||
{!publicPost && ( | ||
<SharePrivateMenuItem | ||
classes={{ root: 'px-[25px]' }} | ||
onClick={sharePrivateLink} | ||
/> | ||
)} | ||
{/*<DeleteMenuItem /> */} | ||
</Menu> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 27 additions & 77 deletions
104
web-components/src/components/cards/PostCard/PostCardActionButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,18 @@ | ||
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; | ||
import React from 'react'; | ||
|
||
interface ShareUnlockIconProps extends SvgIconProps {} | ||
|
||
export default function ShareUnlockIcon({ | ||
sx, | ||
}: ShareUnlockIconProps): JSX.Element { | ||
return ( | ||
<SvgIcon | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
sx={sx} | ||
> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M12 2C9.79086 2 8 3.79086 8 6V9H20C20.5523 9 21 9.44772 21 10V23C21 23.5523 20.5523 24 20 24H4C3.44772 24 3 23.5523 3 23V10C3 9.44771 3.44772 9 4 9H6V6C6 2.68629 8.68629 0 12 0C14.0618 0 15.8806 1.03992 16.9607 2.62385C17.2711 3.07897 17.0471 3.67787 16.5475 3.90996C16.0454 4.14324 15.4573 3.91254 15.1086 3.48247C14.3752 2.57806 13.2551 2 12 2ZM19 11V22H5V11H19Z" | ||
fill="black" | ||
/> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M15.5 13.5C15.5 12.6716 14.8284 12 14 12C13.1716 12 12.5 12.6716 12.5 13.5C12.5 13.6829 12.5327 13.8581 12.5926 14.0202L10.0528 15.4315C9.78196 15.1647 9.41021 15 9 15C8.17157 15 7.5 15.6716 7.5 16.5C7.5 17.3284 8.17157 18 9 18C9.20034 18 9.3915 17.9607 9.56621 17.8895L12.5079 19.6544C12.5852 20.4103 13.2237 21 14 21C14.8284 21 15.5 20.3284 15.5 19.5C15.5 18.6716 14.8284 18 14 18C13.4897 18 13.0388 18.2549 12.7679 18.6443L10.335 17.1846C10.4405 16.9793 10.5 16.7466 10.5 16.5C10.5 16.4433 10.4968 16.3873 10.4907 16.3321L13.2496 14.7991C13.4704 14.9269 13.7266 15 14 15C14.8284 15 15.5 14.3284 15.5 13.5Z" | ||
fill="#7BC796" | ||
/> | ||
</SvgIcon> | ||
); | ||
} | ||
export const ShareUnlockIcon = (props: React.SVGProps<SVGSVGElement>) => ( | ||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" {...props}> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M12 2C9.79086 2 8 3.79086 8 6V9H20C20.5523 9 21 9.44772 21 10V23C21 23.5523 20.5523 24 20 24H4C3.44772 24 3 23.5523 3 23V10C3 9.44771 3.44772 9 4 9H6V6C6 2.68629 8.68629 0 12 0C14.0618 0 15.8806 1.03992 16.9607 2.62385C17.2711 3.07897 17.0471 3.67787 16.5475 3.90996C16.0454 4.14324 15.4573 3.91254 15.1086 3.48247C14.3752 2.57806 13.2551 2 12 2ZM19 11V22H5V11H19Z" | ||
fill="#7BC796" | ||
/> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M15.5 13.5C15.5 12.6716 14.8284 12 14 12C13.1716 12 12.5 12.6716 12.5 13.5C12.5 13.6829 12.5327 13.8581 12.5926 14.0202L10.0528 15.4315C9.78196 15.1647 9.41021 15 9 15C8.17157 15 7.5 15.6716 7.5 16.5C7.5 17.3284 8.17157 18 9 18C9.20034 18 9.3915 17.9607 9.56621 17.8895L12.5079 19.6544C12.5852 20.4103 13.2237 21 14 21C14.8284 21 15.5 20.3284 15.5 19.5C15.5 18.6716 14.8284 18 14 18C13.4897 18 13.0388 18.2549 12.7679 18.6443L10.335 17.1846C10.4405 16.9793 10.5 16.7466 10.5 16.5C10.5 16.4433 10.4968 16.3873 10.4907 16.3321L13.2496 14.7991C13.4704 14.9269 13.7266 15 14 15C14.8284 15 15.5 14.3284 15.5 13.5Z" | ||
fill="#7BC796" | ||
/> | ||
</svg> | ||
); |
Oops, something went wrong.