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
c75cac05
Commit
c75cac05
authored
Apr 24, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create action button
parent
d5925ba9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
ActionButton.tsx
ui/shared/ActionButton.tsx
+77
-0
No files found.
ui/shared/ActionButton.tsx
0 → 100644
View file @
c75cac05
import
{
Button
,
Image
,
Text
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
LinkExternal
from
'
./LinkExternal
'
;
type
Props
=
{
data
?:
{
appId
?:
string
;
actionUrl
:
string
;
textColor
:
string
;
bgColor
:
string
;
text
:
string
;
logoUrl
:
string
;
};
}
const
mockData
=
{
appId
:
'
1
'
,
actionUrl
:
'
https://github.com/
'
,
textColor
:
'
#E2E8F0
'
,
bgColor
:
'
#9747FF
'
,
text
:
'
Mint NFT
'
,
logoUrl
:
'
https://i.ibb.co/PGZ0y9r/tg-image-883021928.jpg
'
,
};
const
ActionButton
=
({
data
=
mockData
}:
Props
)
=>
{
const
{
appId
,
actionUrl
,
textColor
,
bgColor
,
text
,
logoUrl
}
=
data
;
const
defaultTextColor
=
useColorModeValue
(
'
blue.600
'
,
'
blue.300
'
);
const
defaultBg
=
useColorModeValue
(
'
gray.100
'
,
'
gray.700
'
);
const
content
=
(
<>
<
Image
src=
{
logoUrl
}
alt=
{
`${ text } button`
}
boxSize=
{
5
}
borderRadius=
"sm"
mr=
{
2
}
/>
<
Text
fontSize=
"sm"
fontWeight=
"500"
color=
"currentColor"
>
{
text
}
</
Text
>
</>
);
return
appId
?
(
<
Button
as=
"a"
href=
{
actionUrl
}
display=
"flex"
size=
"sm"
px=
{
2
}
color=
{
textColor
||
defaultTextColor
}
bg=
{
bgColor
||
defaultBg
}
_hover=
{
{
bg
:
bgColor
,
opacity
:
0.9
}
}
_active=
{
{
bg
:
bgColor
,
opacity
:
0.9
}
}
>
{
content
}
</
Button
>
)
:
(
<
LinkExternal
href=
{
actionUrl
}
variant=
"subtle"
display=
"flex"
px=
{
2
}
color=
{
textColor
}
bg=
{
bgColor
}
_hover=
{
{
color
:
textColor
}
}
_active=
{
{
color
:
textColor
}
}
>
{
content
}
</
LinkExternal
>
);
};
export
default
ActionButton
;
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