Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C-3967] Migrate common buttons to harmony #7832

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@audius/common/store'
import { formatDateWithTimezoneOffset } from '@audius/common/utils'
import {
Button as HarmonyButton,
Button,
ModalContent,
ModalContentText,
ModalFooter,
Expand All @@ -31,9 +31,9 @@ import {
IconLink,
IconShare,
IconLogoCircleSOL,
IconLogoCircleETH
IconLogoCircleETH,
Flex
} from '@audius/harmony'
import { Button, ButtonSize, ButtonType } from '@audius/stems'
import cn from 'classnames'
import { useDispatch, useSelector } from 'react-redux'

Expand Down Expand Up @@ -289,7 +289,7 @@ const CollectibleDetailsModal = ({
</a>
)}

<div className={styles.detailsButtonContainer}>
<Flex gap='m' wrap='wrap'>
<Toast
text={collectibleMessages.copied}
fillParent={false}
Expand All @@ -299,46 +299,40 @@ const CollectibleDetailsModal = ({
tooltipClassName={styles.shareTooltip}
>
<Button
className={styles.detailsButton}
textClassName={styles.detailsButtonText}
iconClassName={styles.detailsButtonIcon}
variant='common'
size='small'
onClick={() => copyToClipboard(shareUrl)}
text='Share'
type={ButtonType.COMMON_ALT}
size={ButtonSize.SMALL}
leftIcon={<IconShare />}
/>
iconLeft={IconShare}
>
Share
</Button>
</Toast>

<Button
className={styles.detailsButton}
textClassName={styles.detailsButtonText}
iconClassName={styles.detailsButtonIcon}
variant='common'
size='small'
onClick={() => setIsEmbedModalOpen?.(true)}
text='Embed'
type={ButtonType.COMMON_ALT}
size={ButtonSize.SMALL}
leftIcon={<IconEmbed />}
/>
iconLeft={IconEmbed}
>
Embed
</Button>

{isCollectibleOptionEnabled &&
isUserOnTheirProfile &&
collectible.mediaType === CollectibleMediaType.IMAGE && (
<Button
className={styles.detailsButton}
textClassName={styles.detailsButtonText}
iconClassName={styles.detailsButtonIcon}
variant='common'
size='small'
onClick={() => {
setIsModalOpen(false)
setIsPicConfirmaModalOpen(true)
}}
text='Set As Profile Pic'
type={ButtonType.COMMON_ALT}
size={ButtonSize.SMALL}
leftIcon={<IconImage />}
/>
iconLeft={IconImage}
>
Set As Profile Pic
</Button>
)}
</div>
</Flex>
</div>
</div>
</Modal>
Expand All @@ -360,20 +354,16 @@ const CollectibleDetailsModal = ({
</ModalContent>

<ModalFooter>
<HarmonyButton
<Button
variant='secondary'
onClick={() => setIsPicConfirmaModalOpen(false)}
fullWidth
>
{collectibleMessages.setAsProfilePickCancel}
</HarmonyButton>
<HarmonyButton
variant='primary'
onClick={onClickProfPicUpload}
fullWidth
>
</Button>
<Button variant='primary' onClick={onClickProfPicUpload} fullWidth>
{collectibleMessages.setAsProfilePickConfirm}
</HarmonyButton>
</Button>
</ModalFooter>
</Modal>

Expand Down Expand Up @@ -458,15 +448,13 @@ const CollectibleDetailsModal = ({
)}

<Button
className={cn(styles.detailsButton, styles.mobileDetailsButton)}
textClassName={styles.detailsButtonText}
iconClassName={styles.detailsButtonIcon}
variant='common'
size='small'
onClick={handleMobileShareClick}
text='Share'
type={ButtonType.COMMON_ALT}
size={ButtonSize.SMALL}
leftIcon={<IconShare />}
/>
iconLeft={IconShare}
>
Share
</Button>
</div>
</div>
</Drawer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
padding: 0 24px;
}

.header button {
min-width: 82px;
}

.headerText {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -298,33 +294,6 @@
color: var(--neutral-light-2);
}

.detailsButtonContainer {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}

.detailsButton {
padding: 0 var(--unit-4);
}
.detailsButton .detailsButtonText {
color: var(--neutral-light-4);
font-size: var(--font-m);
letter-spacing: 0;
text-transform: uppercase;
}
.detailsButton .detailsButtonIcon {
margin-right: var(--unit-1) !important;
}
.detailsButton .detailsButtonIcon path {
fill: var(--neutral-light-4);
}

.detailsButton.mobileDetailsButton {
width: 100%;
height: var(--unit-9);
}

.nftModal {
display: flex;
align-items: flex-start;
Expand Down Expand Up @@ -668,10 +637,6 @@
margin-bottom: 16px;
}

.mobile .header button {
width: 100%;
}

.mobile .content {
padding: 0 12px;
}
Expand Down Expand Up @@ -720,16 +685,6 @@
padding: 0 12px;
}

.mobileButtonContainer {
display: flex;
gap: 8px;
width: 100%;
}

.mobileButtonContainer .detailsButton {
flex: 1 1 0;
}

@keyframes fadeInVisible {
from {
opacity: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import {
IconPencil,
IconShare,
PopupMenu,
PopupMenuItem
PopupMenuItem,
Button,
Flex
} from '@audius/harmony'
import { Button, ButtonSize, ButtonType } from '@audius/stems'
import cn from 'classnames'
import {
DragDropContext,
Expand Down Expand Up @@ -95,7 +96,8 @@ export const collectibleMessages = {
setAsProfilePicDescription:
'Are you sure you want to change your profile picture?',
setAsProfilePickCancel: 'Nevermind',
setAsProfilePickConfirm: 'Yes'
setAsProfilePickConfirm: 'Yes',
collectibleOptions: 'Collectible Options'
}

const dedupe = (list: any[]) => {
Expand Down Expand Up @@ -582,42 +584,40 @@ const CollectiblesPage = (props: CollectiblesPageProps) => {
</div>

{isMobile ? (
<div className={styles.mobileButtonContainer}>
<Flex gap='s' w='100%'>
{isUserOnTheirProfile && (
<Button
className={styles.detailsButton}
textClassName={styles.detailsButtonText}
iconClassName={styles.detailsButtonIcon}
variant='common'
size='small'
onClick={handleEditClick}
text='Edit'
type={ButtonType.COMMON_ALT}
size={ButtonSize.SMALL}
leftIcon={<IconPencil />}
/>
iconLeft={IconPencil}
fullWidth
>
Edit
</Button>
)}
<Button
className={styles.detailsButton}
textClassName={styles.detailsButtonText}
iconClassName={styles.detailsButtonIcon}
variant='common'
size='small'
onClick={handleShareClick}
text='Share'
type={ButtonType.COMMON_ALT}
size={ButtonSize.SMALL}
leftIcon={<IconShare />}
/>
</div>
iconLeft={IconShare}
fullWidth
>
Share
</Button>
</Flex>
) : (
<PopupMenu
items={overflowMenuItems}
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
renderTrigger={(anchorRef, triggerPopup) => (
<Button
leftIcon={<IconKebabHorizontal />}
variant='secondary'
size='small'
iconLeft={IconKebabHorizontal}
aria-label={collectibleMessages.collectibleOptions}
ref={anchorRef}
onClick={() => triggerPopup()}
text={null}
size={ButtonSize.SMALL}
type={ButtonType.COMMON}
/>
)}
zIndex={zIndex.NAVIGATOR_POPUP}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ import {
usersSocialActions,
CommonState
} from '@audius/common/store'
import { IconKebabHorizontal } from '@audius/harmony'
import { Button, ButtonType } from '@audius/stems'
import { Button, IconKebabHorizontal } from '@audius/harmony'
import { useDispatch, useSelector } from 'react-redux'

import { CollectionMenuProps } from 'components/menu/CollectionMenu'
import Menu from 'components/menu/Menu'

import styles from './CollectionHeader.module.css'

const { getCollection, getUser } = collectionPageSelectors
const { followUser, unfollowUser } = usersSocialActions

const messages = {
follow: 'Follow User',
unfollow: 'Unfollow User'
unfollow: 'Unfollow User',
moreOptions: 'More Options'
}

type OverflowMenuButtonProps = {
Expand Down Expand Up @@ -83,12 +81,11 @@ export const OverflowMenuButton = (props: OverflowMenuButtonProps) => {
<Menu menu={overflowMenu}>
{(ref, triggerPopup) => (
<Button
variant='secondary'
ref={ref}
leftIcon={<IconKebabHorizontal />}
aria-label={messages.moreOptions}
iconLeft={IconKebabHorizontal}
onClick={() => triggerPopup()}
text={null}
textClassName={styles.buttonTextFormatting}
type={ButtonType.COMMON}
/>
)}
</Menu>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {
IconVisibilityHidden,
IconSpecialAccess,
IconVisibilityPublic,
IconCart
IconCart,
Button
} from '@audius/harmony'
import { Button, ButtonSize, ButtonType } from '@audius/stems'
import { set, get } from 'lodash'
import { useSelector } from 'react-redux'
import { toFormikValidationSchema } from 'zod-formik-adapter'
Expand Down Expand Up @@ -52,7 +52,6 @@ import {
SpecialAccessType
} from 'pages/upload-page/fields/types'

import styles from './AccessAndSaleTriggerLegacy.module.css'
import { ContextualMenu } from './ContextualMenu'

const { getUserId } = accountSelectors
Expand Down Expand Up @@ -391,14 +390,15 @@ export const AccessAndSaleTriggerLegacy = (
renderValue={() => null}
previewOverride={(toggleMenu) => (
<Button
className={styles.availabilityButton}
type={ButtonType.COMMON_ALT}
variant='common'
size='small'
css={(theme) => ({ marginTop: theme.spacing.l })}
name='availabilityModal'
text={availabilityButtonTitle}
size={ButtonSize.SMALL}
onClick={toggleMenu}
leftIcon={<AvailabilityIcon />}
/>
iconLeft={AvailabilityIcon}
>
{availabilityButtonTitle}
</Button>
)}
/>
)
Expand Down
Loading