mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
feat(doc): change layout of button in main page
This commit is contained in:
654
docs/package-lock.json
generated
654
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/starlight": "^0.11.0",
|
||||
"@astrojs/starlight": "^0.11.1",
|
||||
"@fontsource/ibm-plex-serif": "^5.0.8",
|
||||
"astro": "^3.0.6",
|
||||
"sharp": "^0.32.5"
|
||||
|
||||
31
docs/src/components/MyIcon.astro
Normal file
31
docs/src/components/MyIcon.astro
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
import { Icons } from './icons';
|
||||
|
||||
interface Props {
|
||||
name: keyof typeof Icons;
|
||||
label?: string;
|
||||
color?: string;
|
||||
size?: string;
|
||||
class?: string;
|
||||
}
|
||||
|
||||
const { name, label, size = '1em', color } = Astro.props;
|
||||
const a11yAttrs = label ? ({ 'aria-label': label } as const) : ({ 'aria-hidden': 'true' } as const);
|
||||
---
|
||||
|
||||
<svg height="1em" viewBox="0 0 512 512"
|
||||
{...a11yAttrs}
|
||||
class={Astro.props.class}
|
||||
fill="currentColor"
|
||||
set:html={Icons[name]}
|
||||
/>
|
||||
|
||||
|
||||
<style define:vars={{ 'sl-icon-color': color, 'sl-icon-size': size }}>
|
||||
svg {
|
||||
color: var(--sl-icon-color);
|
||||
font-size: var(--sl-icon-size, 1em);
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +1,29 @@
|
||||
---
|
||||
import Default from '@astrojs/starlight/components/TableOfContents.astro';
|
||||
import { Icon } from '@astrojs/starlight/components';
|
||||
import Default from '@astrojs/starlight/components/TableOfContents.astro';
|
||||
import MyIcon from './MyIcon.astro';
|
||||
|
||||
---
|
||||
|
||||
<Default {...Astro.props}><slot /></Default>
|
||||
|
||||
|
||||
<a class="action-button" href='https://github.com/tomalaforge/angular-challenges'>
|
||||
<div>Give a star</div>
|
||||
<Icon name='github' size="1.5rem" />
|
||||
</a>
|
||||
<div class="action-footer">
|
||||
<a class="action-button" href='https://github.com/tomalaforge/angular-challenges'>
|
||||
<div>Give a star</div>
|
||||
<Icon name='github' size="1rem" />
|
||||
</a>
|
||||
|
||||
<a class="action-button" href='https://github.com/sponsors/tomalaforge'>
|
||||
<div>Sponsor</div>
|
||||
<MyIcon name='heart' size="1rem" color="white" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.action-button {
|
||||
display: flex!important;
|
||||
justify-content: center;
|
||||
width: fit-content;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
border-radius: 999rem;
|
||||
@@ -26,6 +33,13 @@ import { Icon } from '@astrojs/starlight/components';
|
||||
font-size: var(--sl-text-sm)!important;
|
||||
border: 1px solid;
|
||||
font-size: var(--sl-text-base);
|
||||
padding: 0.5rem 0.8rem;
|
||||
padding: 0.4rem 0.8rem;
|
||||
}
|
||||
|
||||
.action-footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.7rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
6
docs/src/components/icons.ts
Normal file
6
docs/src/components/icons.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export const Icons = {
|
||||
heart:
|
||||
'<path d="M225.8 468.2l-2.5-2.3L48.1 303.2C17.4 274.7 0 234.7 0 192.8v-3.3c0-70.4 50-130.8 119.2-144C158.6 37.9 198.9 47 231 69.6c9 6.4 17.4 13.8 25 22.3c4.2-4.8 8.7-9.2 13.5-13.3c3.7-3.2 7.5-6.2 11.5-9c0 0 0 0 0 0C313.1 47 353.4 37.9 392.8 45.4C462 58.6 512 119.1 512 189.5v3.3c0 41.9-17.4 81.9-48.1 110.4L288.7 465.9l-2.5 2.3c-8.2 7.6-19 11.9-30.2 11.9s-22-4.2-30.2-11.9zM239.1 145c-.4-.3-.7-.7-1-1.1l-17.8-20c0 0-.1-.1-.1-.1c0 0 0 0 0 0c-23.1-25.9-58-37.7-92-31.2C81.6 101.5 48 142.1 48 189.5v3.3c0 28.5 11.9 55.8 32.8 75.2L256 430.7 431.2 268c20.9-19.4 32.8-46.7 32.8-75.2v-3.3c0-47.3-33.6-88-80.1-96.9c-34-6.5-69 5.4-92 31.2c0 0 0 0-.1 .1s0 0-.1 .1l-17.8 20c-.3 .4-.7 .7-1 1.1c-4.5 4.5-10.6 7-16.9 7s-12.4-2.5-16.9-7z"/>',
|
||||
fillHeart:
|
||||
'<path d="M47.6 300.4L228.3 469.1c7.5 7 17.4 10.9 27.7 10.9s20.2-3.9 27.7-10.9L464.4 300.4c30.4-28.3 47.6-68 47.6-109.5v-5.8c0-69.9-50.5-129.5-119.4-141C347 36.5 300.6 51.4 268 84L256 96 244 84c-32.6-32.6-79-47.5-124.6-39.9C50.5 55.6 0 115.2 0 185.1v5.8c0 41.5 17.2 81.2 47.6 109.5z"/>',
|
||||
};
|
||||
@@ -22,6 +22,7 @@ hero:
|
||||
---
|
||||
|
||||
import { Card, CardGrid } from '@astrojs/starlight/components';
|
||||
import MyIcon from '../../components/MyIcon.astro';
|
||||
|
||||
<CardGrid>
|
||||
<Card title="38 Challenges">
|
||||
@@ -57,11 +58,9 @@ import { Card, CardGrid } from '@astrojs/starlight/components';
|
||||
---
|
||||
|
||||
<div class="article-footer">
|
||||
<a
|
||||
href="https://github.com/sponsors/tomalaforge"
|
||||
alt="Sponsor link"
|
||||
class="primary action astro-yjy4zhro">
|
||||
🤍 Sponsor the Project
|
||||
<a href="https://github.com/sponsors/tomalaforge" alt="Sponsor link">
|
||||
<MyIcon name="fillHeart" size="1.2rem" color="white" />
|
||||
Sponsor the Project
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@
|
||||
background-color: var(--sl-color-accent-high);
|
||||
}
|
||||
|
||||
.article-footer > a > p {
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
a.primary,
|
||||
a.primary > svg {
|
||||
color: var(--color-btn) !important;
|
||||
@@ -120,7 +124,3 @@ starlight-menu-button svg {
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* .content-panel {
|
||||
padding-top: 2px;
|
||||
} */
|
||||
|
||||
Reference in New Issue
Block a user