-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from l3vels/feat/subnets-page
feat: subnets page
- Loading branch information
Showing
9 changed files
with
681 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
import styled from 'styled-components' | ||
|
||
import Typography from 'share-ui/components/typography/Typography' | ||
|
||
import AvatarGenerator from 'components/AvatarGenerator/AvatarGenerator' | ||
|
||
import TypographySecondary from 'components/Typography/Secondary' | ||
import TypographyPrimary from 'components/Typography/Primary' | ||
|
||
import { textSlicer } from 'utils/textSlicer' | ||
import Switcher from './Switcher' | ||
|
||
type ApiCardProps = { | ||
name: string | ||
description: string | ||
headerText?: string | ||
headerTag?: string | ||
avatar?: string | ||
icon?: string | ||
} | ||
|
||
const ApiCard = ({ name, description, headerTag, avatar, icon }: ApiCardProps) => { | ||
const { shortText: shortName } = textSlicer(name, 25) | ||
|
||
let shortHeaderTag | ||
if (headerTag) { | ||
const { shortText } = textSlicer(headerTag, 40) | ||
shortHeaderTag = shortText | ||
} | ||
|
||
return ( | ||
<StyledApiCard> | ||
<StyledCardHeader> | ||
<StyledAvatarWrapper> | ||
{icon ? <StyledIcon>{icon}</StyledIcon> : <StyledImg src={avatar} />} | ||
</StyledAvatarWrapper> | ||
|
||
<StyledTitleWrapper> | ||
<TypographyPrimary | ||
value={shortName} | ||
type={Typography.types.P} | ||
size={Typography.sizes.sm} | ||
/> | ||
</StyledTitleWrapper> | ||
|
||
<StyledSwitcherWrapper> | ||
<Switcher /> | ||
</StyledSwitcherWrapper> | ||
</StyledCardHeader> | ||
<StyledCardBody> | ||
<StyledBodyTextWrapper> | ||
<TypographySecondary | ||
value={description} | ||
type={Typography.types.P} | ||
size={Typography.sizes.sm} | ||
/> | ||
</StyledBodyTextWrapper> | ||
</StyledCardBody> | ||
</StyledApiCard> | ||
) | ||
} | ||
|
||
export default ApiCard | ||
|
||
export const StyledApiCard = styled.div` | ||
position: relative; | ||
width: 300px; | ||
min-width: 300px; | ||
height: 170px; | ||
min-height: 170px; | ||
padding: 15px; | ||
padding-bottom: 10px; | ||
padding-top: 20px; | ||
border-radius: 22px; | ||
/* background: rgba(0, 0, 0, 0.5); */ | ||
background: ${({ theme }) => theme.body.cardBgColor}; | ||
/* border: ${({ theme }) => theme.body.border}; */ | ||
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
:hover { | ||
.cardFooter { | ||
opacity: 1; | ||
} | ||
} | ||
.components-IconButton-IconButton-module__iconButtonContainer--ttuRB { | ||
&:hover { | ||
background: ${({ theme }) => theme.body.humanMessageBgColor}; | ||
border-radius: 50%; | ||
} | ||
} | ||
` | ||
const StyledCardHeader = styled.div` | ||
width: 100%; | ||
padding-bottom: 12px; | ||
display: flex; | ||
align-items: center; | ||
gap: 10px; | ||
margin-bottom: 5px; | ||
min-height: 20px; | ||
` | ||
|
||
const StyledCardBody = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
margin-top: auto; | ||
display: flex; | ||
gap: 15px; | ||
overflow: hidden; | ||
` | ||
|
||
const StyledBodyTextWrapper = styled.div` | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: 3; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-height: 70px; | ||
` | ||
const StyledAvatarWrapper = styled.div` | ||
text-align: center; | ||
height: fit-content; | ||
` | ||
const StyledIcon = styled.span` | ||
font-size: 30px; | ||
` | ||
|
||
const StyledTitleWrapper = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
font-weight: 500; | ||
` | ||
const StyledImg = styled.img` | ||
width: 34px; | ||
height: 34px; | ||
object-fit: contain; | ||
border-radius: 8px; | ||
` | ||
const StyledSwitcherWrapper = styled.div` | ||
margin-left: auto; | ||
` |
Oops, something went wrong.