Commit 60fad46d authored by Max Alekseenko's avatar Max Alekseenko

add share button to app modal and update colors

parent bb881d1c
...@@ -9,13 +9,13 @@ type Props = { ...@@ -9,13 +9,13 @@ type Props = {
} }
const FavoriteIcon = ({ isFavorite, color }: Props) => { const FavoriteIcon = ({ isFavorite, color }: Props) => {
const heartFilledColor = useColorModeValue('blue.700', 'gray.400'); const heartFilledColor = useColorModeValue('blue.600', 'blue.300');
const defaultColor = isFavorite ? heartFilledColor : 'gray.400'; const defaultColor = isFavorite ? heartFilledColor : (color || 'gray.400');
return ( return (
<IconSvg <IconSvg
name={ isFavorite ? 'heart_filled' : 'heart_outline' } name={ isFavorite ? 'heart_filled' : 'heart_outline' }
color={ color || defaultColor } color={ defaultColor }
boxSize={ 5 } boxSize={ 5 }
/> />
); );
......
...@@ -185,6 +185,7 @@ const MarketplaceAppCard = ({ ...@@ -185,6 +185,7 @@ const MarketplaceAppCard = ({
aria-label="Mark as favorite" aria-label="Mark as favorite"
title="Mark as favorite" title="Mark as favorite"
variant="ghost" variant="ghost"
colorScheme="gray"
w={{ base: 6, md: '30px' }} w={{ base: 6, md: '30px' }}
h={{ base: 6, md: '30px' }} h={{ base: 6, md: '30px' }}
onClick={ handleFavoriteClick } onClick={ handleFavoriteClick }
...@@ -196,6 +197,7 @@ const MarketplaceAppCard = ({ ...@@ -196,6 +197,7 @@ const MarketplaceAppCard = ({
icon="share" icon="share"
size={ 4 } size={ 4 }
variant="ghost" variant="ghost"
colorScheme="gray"
w={{ base: 6, md: '30px' }} w={{ base: 6, md: '30px' }}
h={{ base: 6, md: '30px' }} h={{ base: 6, md: '30px' }}
color="gray.400" color="gray.400"
......
...@@ -10,7 +10,9 @@ import { ContractListTypes } from 'types/client/marketplace'; ...@@ -10,7 +10,9 @@ import { ContractListTypes } from 'types/client/marketplace';
import config from 'configs/app'; import config from 'configs/app';
import useIsMobile from 'lib/hooks/useIsMobile'; import useIsMobile from 'lib/hooks/useIsMobile';
import { nbsp } from 'lib/html-entities'; import { nbsp } from 'lib/html-entities';
import isBrowser from 'lib/isBrowser';
import * as mixpanel from 'lib/mixpanel/index'; import * as mixpanel from 'lib/mixpanel/index';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
import type { IconName } from 'ui/shared/IconSvg'; import type { IconName } from 'ui/shared/IconSvg';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
...@@ -113,6 +115,8 @@ const MarketplaceAppModal = ({ ...@@ -113,6 +115,8 @@ const MarketplaceAppModal = ({
} catch (err) {} } catch (err) {}
} }
const iconColor = useColorModeValue('blue.600', 'gray.400');
return ( return (
<Modal <Modal
isOpen={ Boolean(data.id) } isOpen={ Boolean(data.id) }
...@@ -206,8 +210,23 @@ const MarketplaceAppModal = ({ ...@@ -206,8 +210,23 @@ const MarketplaceAppModal = ({
colorScheme="gray" colorScheme="gray"
w={ 9 } w={ 9 }
h={ 8 } h={ 8 }
flexShrink={ 0 }
onClick={ handleFavoriteClick } onClick={ handleFavoriteClick }
icon={ <FavoriteIcon isFavorite={ isFavorite } color={ useColorModeValue('blue.700', 'gray.400') }/> } icon={ <FavoriteIcon isFavorite={ isFavorite } color={ iconColor }/> }
/>
<CopyToClipboard
text={ isBrowser() ? window.location.origin + `/apps/${ id }` : '' }
icon="share"
size={ 4 }
variant="outline"
colorScheme="gray"
w={ 9 }
h={ 8 }
color={ iconColor }
_hover={{ color: iconColor }}
display="inline-flex"
borderRadius="base"
/> />
</Flex> </Flex>
</Flex> </Flex>
......
...@@ -13,9 +13,10 @@ export interface Props { ...@@ -13,9 +13,10 @@ export interface Props {
type?: 'link'; type?: 'link';
icon?: IconName; icon?: IconName;
variant?: string; variant?: string;
colorScheme?: string;
} }
const CopyToClipboard = ({ text, className, isLoading, onClick, size = 5, type, icon, variant = 'simple' }: Props) => { const CopyToClipboard = ({ text, className, isLoading, onClick, size = 5, type, icon, variant = 'simple', colorScheme }: Props) => {
const { hasCopied, onCopy } = useClipboard(text, 1000); const { hasCopied, onCopy } = useClipboard(text, 1000);
const [ copied, setCopied ] = useState(false); const [ copied, setCopied ] = useState(false);
// have to implement controlled tooltip because of the issue - https://github.com/chakra-ui/chakra-ui/issues/7107 // have to implement controlled tooltip because of the issue - https://github.com/chakra-ui/chakra-ui/issues/7107
...@@ -48,6 +49,7 @@ const CopyToClipboard = ({ text, className, isLoading, onClick, size = 5, type, ...@@ -48,6 +49,7 @@ const CopyToClipboard = ({ text, className, isLoading, onClick, size = 5, type,
boxSize={ size } boxSize={ size }
color={ iconColor } color={ iconColor }
variant={ variant } variant={ variant }
colorScheme={ colorScheme }
display="inline-block" display="inline-block"
flexShrink={ 0 } flexShrink={ 0 }
onClick={ handleClick } onClick={ handleClick }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment