Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
3b9cbad3
Commit
3b9cbad3
authored
Apr 10, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create FeaturedAppMobile component
parent
4aba1703
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
168 additions
and
22 deletions
+168
-22
FeaturedApp.tsx
ui/marketplace/Banner/FeaturedApp.tsx
+10
-22
FeaturedAppMobile.tsx
ui/marketplace/Banner/FeaturedAppMobile.tsx
+158
-0
No files found.
ui/marketplace/Banner/FeaturedApp.tsx
View file @
3b9cbad3
import
{
Link
,
Skeleton
,
useColorModeValue
,
LinkBox
,
Flex
,
Image
,
LinkOverlay
,
IconButton
,
useBreakpointValue
}
from
'
@chakra-ui/react
'
;
import
{
Link
,
Skeleton
,
useColorModeValue
,
LinkBox
,
Flex
,
Image
,
LinkOverlay
,
IconButton
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
type
{
MouseEvent
}
from
'
react
'
;
import
React
,
{
useCallback
}
from
'
react
'
;
import
type
{
MarketplaceAppPreview
}
from
'
types/client/marketplace
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
MarketplaceAppCard
from
'
../MarketplaceAppCard
'
;
import
MarketplaceAppIntegrationIcon
from
'
../MarketplaceAppIntegrationIcon
'
;
import
FeaturedAppMobile
from
'
./FeaturedAppMobile
'
;
type
FeaturedAppProps
=
{
app
:
MarketplaceAppPreview
;
...
...
@@ -22,9 +23,9 @@ type FeaturedAppProps = {
const
FeaturedApp
=
({
app
,
isFavorite
,
isLoading
,
onAppClick
,
onInfoClick
:
onInfoClickProp
,
onFavoriteClick
:
onFavoriteClickProp
,
onInfoClick
,
onFavoriteClick
,
}:
FeaturedAppProps
)
=>
{
const
isMobile
=
use
BreakpointValue
({
base
:
true
,
sm
:
false
}
);
const
isMobile
=
use
IsMobile
(
);
const
{
id
,
url
,
external
,
title
,
logo
,
logoDarkMode
,
shortDescription
,
categories
,
internalWallet
}
=
app
;
const
logoUrl
=
useColorModeValue
(
logo
,
logoDarkMode
||
logo
);
...
...
@@ -32,38 +33,25 @@ const FeaturedApp = ({
const
backgroundColor
=
useColorModeValue
(
'
purple.50
'
,
'
whiteAlpha.100
'
);
const
onInfoClick
=
useCallback
((
id
:
string
)
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
,
Source
:
'
Banner
'
});
onInfoClickProp
(
id
);
},
[
onInfoClickProp
]);
const
onFavoriteClick
=
useCallback
((
id
:
string
,
isFavorite
:
boolean
)
=>
{
onFavoriteClickProp
(
id
,
isFavorite
,
'
Banner
'
);
},
[
onFavoriteClickProp
]);
const
handleInfoClick
=
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
,
Source
:
'
Banner
'
});
onInfoClick
(
id
);
},
[
onInfoClick
,
id
]);
const
handleFavoriteClick
=
useCallback
(()
=>
{
onFavoriteClick
(
id
,
isFavorite
);
onFavoriteClick
(
id
,
isFavorite
,
'
Banner
'
);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
if
(
isMobile
)
{
return
(
<
MarketplaceAppCard
<
FeaturedAppMobile
{
...
app
}
onInfoClick=
{
on
InfoClick
}
onInfoClick=
{
handle
InfoClick
}
isFavorite=
{
isFavorite
}
onFavoriteClick=
{
on
FavoriteClick
}
onFavoriteClick=
{
handle
FavoriteClick
}
isLoading=
{
isLoading
}
onAppClick=
{
onAppClick
}
_hover=
{
{
boxShadow
:
'
none
'
}
}
_focusWithin=
{
{
boxShadow
:
'
none
'
}
}
border=
"none"
background=
{
backgroundColor
}
mb=
{
4
}
/>
);
}
...
...
ui/marketplace/Banner/FeaturedAppMobile.tsx
0 → 100644
View file @
3b9cbad3
import
{
IconButton
,
Image
,
Link
,
LinkBox
,
Skeleton
,
useColorModeValue
,
Flex
}
from
'
@chakra-ui/react
'
;
import
type
{
MouseEvent
}
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
MarketplaceAppPreview
}
from
'
types/client/marketplace
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
MarketplaceAppCardLink
from
'
../MarketplaceAppCardLink
'
;
import
MarketplaceAppIntegrationIcon
from
'
../MarketplaceAppIntegrationIcon
'
;
interface
Props
extends
MarketplaceAppPreview
{
onInfoClick
:
(
event
:
MouseEvent
)
=>
void
;
isFavorite
:
boolean
;
onFavoriteClick
:
()
=>
void
;
isLoading
:
boolean
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
}
const
FeaturedAppMobile
=
({
id
,
url
,
external
,
title
,
logo
,
logoDarkMode
,
shortDescription
,
categories
,
onInfoClick
,
isFavorite
,
onFavoriteClick
,
isLoading
,
internalWallet
,
onAppClick
,
}:
Props
)
=>
{
const
categoriesLabel
=
categories
.
join
(
'
,
'
);
const
logoUrl
=
useColorModeValue
(
logo
,
logoDarkMode
||
logo
);
return
(
<
LinkBox
borderRadius=
"md"
padding=
{
{
base
:
3
,
sm
:
'
20px
'
}
}
role=
"group"
background=
{
useColorModeValue
(
'
purple.50
'
,
'
whiteAlpha.100
'
)
}
mb=
{
4
}
>
<
Flex
flexDirection=
"row"
height=
"100%"
alignContent=
"start"
gap=
{
4
}
>
<
Flex
flexDirection=
"column"
alignItems=
"center"
justifyContent=
"space-between"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
w=
{
{
base
:
'
64px
'
,
sm
:
'
96px
'
}
}
h=
{
{
base
:
'
64px
'
,
sm
:
'
96px
'
}
}
display=
"flex"
alignItems=
"center"
justifyContent=
"center"
>
<
Image
src=
{
isLoading
?
undefined
:
logoUrl
}
alt=
{
`${ title } app icon`
}
borderRadius=
"8px"
/>
</
Skeleton
>
{
!
isLoading
&&
(
<
Flex
position=
{
{
base
:
'
relative
'
,
sm
:
'
absolute
'
}
}
right=
{
{
base
:
0
,
sm
:
'
50px
'
}
}
top=
{
{
base
:
0
,
sm
:
'
24px
'
}
}
>
<
Link
fontSize=
{
{
base
:
'
xs
'
,
sm
:
'
sm
'
}
}
fontWeight=
"500"
paddingRight=
{
{
sm
:
2
}
}
href=
"#"
onClick=
{
onInfoClick
}
>
More info
</
Link
>
</
Flex
>
)
}
</
Flex
>
<
Flex
flexDirection=
"column"
gap=
{
2
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontSize=
{
{
base
:
'
sm
'
,
sm
:
'
lg
'
}
}
lineHeight=
{
{
base
:
'
20px
'
,
sm
:
'
28px
'
}
}
paddingRight=
{
{
base
:
'
25px
'
,
sm
:
'
110px
'
}
}
fontWeight=
"semibold"
fontFamily=
"heading"
display=
"inline-block"
>
<
MarketplaceAppCardLink
id=
{
id
}
url=
{
url
}
external=
{
external
}
title=
{
title
}
onClick=
{
onAppClick
}
/>
<
MarketplaceAppIntegrationIcon
external=
{
external
}
internalWallet=
{
internalWallet
}
/>
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
color=
"text_secondary"
fontSize=
"xs"
lineHeight=
"16px"
>
<
span
>
{
categoriesLabel
}
</
span
>
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
fontSize=
{
{
base
:
'
xs
'
,
sm
:
'
sm
'
}
}
lineHeight=
"20px"
noOfLines=
{
3
}
>
{
shortDescription
}
</
Skeleton
>
</
Flex
>
{
!
isLoading
&&
(
<
IconButton
display=
"flex"
alignItems=
"center"
justifyContent=
"center"
position=
"absolute"
right=
{
{
base
:
1
,
sm
:
'
10px
'
}
}
top=
{
{
base
:
1
,
sm
:
'
18px
'
}
}
aria
-
label=
"Mark as favorite"
title=
"Mark as favorite"
variant=
"ghost"
colorScheme=
"gray"
w=
{
9
}
h=
{
8
}
onClick=
{
onFavoriteClick
}
icon=
{
isFavorite
?
<
IconSvg
name=
"star_filled"
w=
{
5
}
h=
{
5
}
color=
"yellow.400"
/>
:
<
IconSvg
name=
"star_outline"
w=
{
5
}
h=
{
5
}
color=
"gray.400"
/>
}
/>
)
}
</
Flex
>
</
LinkBox
>
);
};
export
default
React
.
memo
(
FeaturedAppMobile
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment