-
Notifications
You must be signed in to change notification settings - Fork 17
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 #5 from AnaRangel/zyruks/feature/simple-cards
Zyruk: Simple cards
- Loading branch information
Showing
22 changed files
with
675 additions
and
50 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
export { default as Button } from './Button.astro'; |
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,66 @@ | ||
--- | ||
import { CardVariant } from '@components'; | ||
interface Props { | ||
/** | ||
* The class name for the card wrapper. | ||
*/ | ||
className?: string; | ||
/** | ||
* The variant of the card. | ||
*/ | ||
variant?: CardVariant; | ||
/** | ||
* Determines whether the card has a border or not. | ||
*/ | ||
hasBorder?: boolean; | ||
/** | ||
* Determines whether the card should take up the full width or not. | ||
*/ | ||
isFullWidth?: boolean; | ||
} | ||
const { className, variant = CardVariant.primary, hasBorder } = Astro.props; | ||
function getBorderAttributes() { | ||
return hasBorder ? { 'data-has-border': true } : {}; | ||
} | ||
--- | ||
|
||
<article {...getBorderAttributes()} class:list={[className]} data-variant={variant}> | ||
<slot /> | ||
</article> | ||
|
||
<style> | ||
article { | ||
border: 1px solid hsl(0deg 0% 16%); | ||
border-radius: 1.5rem; | ||
} | ||
|
||
article:not([data-has-border]) { | ||
border: none; | ||
} | ||
|
||
/*********************************************** | ||
VARIANTS | ||
***********************************************/ | ||
|
||
article[data-variant='primary'] { | ||
background: hsl(240deg 2% 9%); | ||
} | ||
|
||
article[data-variant='secondary'] { | ||
background: linear-gradient( | ||
127.36deg, | ||
rgb(46 88 255 / 30%) 5.98%, | ||
rgb(148 82 255 / 30%) 90.92% | ||
); | ||
} | ||
|
||
article[data-variant='tertiary'] { | ||
background: linear-gradient(90deg, rgb(48 183 202 / 30%) 0%, rgb(33 212 155 / 30%) 100.01%); | ||
} | ||
</style> |
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 @@ | ||
export { default as CardWrapper } from './CardWrapper.astro'; |
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,5 @@ | ||
export enum CardVariant { | ||
primary = 'primary', | ||
secondary = 'secondary', | ||
tertiary = 'tertiary', | ||
} |
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,122 @@ | ||
--- | ||
import { CardVariant, CardWrapper, Icon, IconCatalog, IconSize, IconStyle } from '@components'; | ||
interface Props { | ||
/** | ||
* The variant of the card. | ||
*/ | ||
variant?: CardVariant; | ||
/** | ||
* Determines whether the card has a border or not. | ||
*/ | ||
hasBorder?: boolean; | ||
/** | ||
* Determines whether the card is inverted or not. | ||
*/ | ||
isInverted?: boolean; | ||
/** | ||
* The text content of the card. | ||
*/ | ||
cardText?: string; | ||
/** | ||
* The image URL for the card. | ||
*/ | ||
cardImage?: string; | ||
/** | ||
* The URL to navigate to when the card is clicked. | ||
*/ | ||
url?: string; | ||
} | ||
const { | ||
variant = CardVariant.primary, | ||
hasBorder = true, | ||
isInverted = false, | ||
cardText, | ||
cardImage, | ||
url, | ||
} = Astro.props; | ||
--- | ||
|
||
<CardWrapper hasBorder={hasBorder} variant={variant}> | ||
{ | ||
// TODO: Look for a better way to render this | ||
!isInverted ? ( | ||
<div class="card-container"> | ||
<img class="logo-img" src={cardImage} alt="hey" slot="header" /> | ||
<p class="card-text" slot="content"> | ||
{cardText} | ||
</p> | ||
</div> | ||
) : ( | ||
<a href={url}> | ||
<div class="card-container"> | ||
<div slot="header" class="card-header--with-icon"> | ||
<h3 class="card-text">{cardText}</h3> | ||
|
||
<Icon | ||
classes="card-icon" | ||
icon={IconCatalog.arrowRight} | ||
size={IconSize['7xl']} | ||
iconStyle={IconStyle.bold} | ||
/> | ||
</div> | ||
<img src={cardImage} alt="hey" slot="content" /> | ||
</div> | ||
</a> | ||
) | ||
} | ||
</CardWrapper> | ||
|
||
<style> | ||
.card-container { | ||
block-size: 26rem; | ||
max-inline-size: 38rem; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
|
||
padding-block: 3rem 0; | ||
padding-inline: 3rem; | ||
} | ||
|
||
.card-container:has(p) { | ||
padding-block: 3rem; | ||
} | ||
|
||
h3 { | ||
font-weight: 600; | ||
font-size: 2.25rem; | ||
line-height: 2.25rem; | ||
} | ||
|
||
p { | ||
font-weight: 500; | ||
font-size: 2.25rem; | ||
font-family: Inter, sans-serif; | ||
line-height: 3.375rem; | ||
} | ||
|
||
.logo-img { | ||
inline-size: 100%; | ||
max-inline-size: 14rem; | ||
max-block-size: 5rem; | ||
} | ||
|
||
.card-header--with-icon { | ||
display: flex; | ||
gap: 1rem; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
.card-container:hover { | ||
--icon-color: var(--color-primary-400); | ||
--icon-transform: 0.4rem; | ||
} | ||
</style> |
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,3 @@ | ||
export * from './Cards.type'; | ||
export * from './CardWrapper'; | ||
export { default as SimpleCard } from './SimpleCard/SimpleCard.astro'; |
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,2 @@ | ||
export { default as Icon } from './Icon.astro'; | ||
export * from './Icons'; |
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,3 @@ | ||
export { default as Button } from './Button/Button.astro'; | ||
export * from './Cards'; | ||
export * from './Icon'; |
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
Oops, something went wrong.