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

Set flip menu link to full width #896

Merged
merged 1 commit into from
Mar 23, 2023
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
13 changes: 7 additions & 6 deletions renderer/pages/flips/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,13 @@ export default function FlipListPage() {
openDeleteForm()
}}
>
<FlipCardMenuItemIcon
icon={DeleteIcon}
mr="2"
color="red.500"
/>
{t('Delete flip')}
<HStack spacing="2">
<FlipCardMenuItemIcon
icon={DeleteIcon}
color="red.500"
/>
<Text as="span">{t('Delete flip')}</Text>
</HStack>
</FlipCardMenuItem>
</FlipCardMenu>
</Flex>
Expand Down
12 changes: 6 additions & 6 deletions renderer/pages/flips/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
useDisclosure,
CloseButton,
useToast,
Text,
HStack,
} from '@chakra-ui/react'
import {useTranslation} from 'react-i18next'
import {useMachine} from '@xstate/react'
Expand Down Expand Up @@ -187,12 +189,10 @@ export default function ViewFlipPage() {
else send('ARCHIVE')
}}
>
<FlipCardMenuItemIcon
icon={DeleteIcon}
mr="2"
color="red.500"
/>
{t('Delete flip')}
<HStack spacing="2">
<FlipCardMenuItemIcon icon={DeleteIcon} color="red.500" />
<Text as="span">{t('Delete flip')}</Text>
</HStack>
</FlipCardMenuItem>
</FlipCardMenu>
</FlipMasterFooter>
Expand Down
81 changes: 30 additions & 51 deletions renderer/screens/flips/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ import {
Center,
useRadio,
useRadioGroup,
Popover,
PopoverTrigger,
PopoverContent,
PopoverArrow,
PopoverBody,
} from '@chakra-ui/react'
import {DragDropContext, Droppable, Draggable} from 'react-beautiful-dnd'
import {useTranslation} from 'react-i18next'
Expand Down Expand Up @@ -174,42 +169,42 @@ export function FlipCard({flipService, onDelete}) {
<FlipCardMenu>
{isSubmittable && (
<FlipCardMenuItem onClick={() => send('PUBLISH', {id})}>
<FlipCardMenuItemIcon icon={UploadIcon} mr={2} />
{t('Submit flip')}
<HStack spacing="2">
<FlipCardMenuItemIcon icon={UploadIcon} />
<Text as="span">{t('Submit flip')}</Text>
</HStack>
</FlipCardMenuItem>
)}
{isViewable && (
<FlipCardMenuItem>
<NextLink href={`/flips/view?id=${id}`}>
<Flex>
<FlipCardMenuItemIcon icon={EyeIcon} mr={2} />
{t('View flip')}
</Flex>
</NextLink>
</FlipCardMenuItem>
<NextLink href={`/flips/view?id=${id}`}>
<FlipCardMenuItem>
<HStack spacing="2">
<FlipCardMenuItemIcon icon={EyeIcon} />
<Text as="span">{t('View flip')}</Text>
</HStack>
</FlipCardMenuItem>
</NextLink>
)}
{isEditable && (
<FlipCardMenuItem>
<NextLink href={`/flips/edit?id=${id}`}>
<Flex>
<FlipCardMenuItemIcon icon={EditIcon} mr={2} />
{t('Edit flip')}
</Flex>
</NextLink>
</FlipCardMenuItem>
<NextLink href={`/flips/edit?id=${id}`}>
<FlipCardMenuItem>
<HStack spacing="2">
<FlipCardMenuItemIcon icon={EditIcon} />
<Text as="span">{t('Edit flip')}</Text>
</HStack>
</FlipCardMenuItem>
</NextLink>
)}
{(isSubmittable || isEditable) && isDeletable && (
<MenuDivider color="gray.300" my={2} width={rem(145)} />
)}

{isDeletable && (
<FlipCardMenuItem onClick={onDelete}>
<FlipCardMenuItemIcon
icon={DeleteIcon}
mr={2}
color="red.500"
/>
{t('Delete flip')}
<HStack spacing="2">
<FlipCardMenuItemIcon icon={DeleteIcon} color="red.500" />
<Text as="span">{t('Delete flip')}</Text>
</HStack>
</FlipCardMenuItem>
)}
</FlipCardMenu>
Expand Down Expand Up @@ -278,7 +273,7 @@ export function FlipCardMenuItem(props) {
return (
<Box
as={MenuItem}
color="brandGray.500"
color="gray.500"
fontWeight={500}
px={3}
py="3/2"
Expand All @@ -292,7 +287,7 @@ export function FlipCardMenuItem(props) {
}

export function FlipCardMenuItemIcon({icon: MenuIcon, ...props}) {
return <MenuIcon boxSize="5" mr="3" color="blue.500" {...props} />
return <MenuIcon color="blue.500" h="5" w="5" {...props} />
}

export function RequiredFlipPlaceholder({title}) {
Expand Down Expand Up @@ -1232,7 +1227,7 @@ export function CommunityTranslations({
<Stack spacing={isOpen ? 8 : 0}>
<IconButton2
icon={<CommunityIcon />}
color="brandGray.500"
color="gray.500"
px={0}
_hover={{background: 'transparent'}}
onClick={onToggle}
Expand Down Expand Up @@ -1399,7 +1394,7 @@ export function VoteButton(props) {
return (
<IconButton
bg="transparent"
color="brandGray.500"
color="gray.500"
fontSize={rem(20)}
h={5}
w={5}
Expand Down Expand Up @@ -1445,13 +1440,13 @@ export function DeleteFlipDrawer({hash, cover, isMissing, onDelete, ...props}) {
>
<DeleteIcon boxSize="6" color="red.500" />
</Flex>
<Heading fontSize="lg" fontWeight={500} color="brandGray.500" mt={4}>
<Heading fontSize="lg" fontWeight={500} color="gray.500" mt="4">
{t('Delete flip')}
</Heading>
</DrawerHeader>
<DrawerBody>
{!isMissing && (
<Text color="brandGray.500" fontSize="md">
<Text color="gray.500" fontSize="md">
{t('Deleted flip will be moved to the drafts.')}
</Text>
)}
Expand Down Expand Up @@ -1579,19 +1574,3 @@ export function PublishFlipDrawer({isPending, flip, onSubmit, ...props}) {
</AdDrawer>
)
}

export function ShuffleAdversarialPopover({label, children, ...props}) {
return (
<Popover placement="right">
<PopoverTrigger>{children}</PopoverTrigger>
<PopoverContent border="none" fontSize="sm" w="max-content">
<PopoverArrow bg="graphite.500" />
<PopoverBody bg="graphite.500" borderRadius="sm" p="2" pt="1">
<Text color="white" fontSize="sm">
{label}
</Text>
</PopoverBody>
</PopoverContent>
</Popover>
)
}