refactor: refactored index page

This commit is contained in:
Sergey Yarkov 2022-07-19 20:04:35 +03:00
parent 85e854cc71
commit 4613a61d25
13 changed files with 95 additions and 78 deletions

View File

@ -1,5 +1,5 @@
{ {
"printWidth": 100, "printWidth": 150,
"semi": true, "semi": true,
"singleQuote": true, "singleQuote": true,
"tabWidth": 2, "tabWidth": 2,

View File

@ -0,0 +1,18 @@
---
import { Icon } from 'astro-icon';
import './Link.scss';
export interface Props {
icon: string;
href: string;
}
const { icon, href } = Astro.props as Props;
---
<div class='splash-link'>
<Icon name={icon} width='18' height='18' />
<a href={href}>
<slot></slot>
</a>
</div>

View File

@ -0,0 +1,9 @@
.splash-link {
display: flex;
align-items: center;
column-gap: 5px;
& a {
color: var(--font-color-gray);
}
}

View File

@ -0,0 +1,7 @@
---
import './Splash.scss';
---
<section class='splash container'>
<slot></slot>
</section>

View File

@ -0,0 +1,4 @@
.splash {
margin-top: 40px;
margin-bottom: 150px;
}

View File

@ -0,0 +1,7 @@
---
import './SplashHeading.scss';
---
<header class='splash-heading'>
<slot></slot>
</header>

View File

@ -0,0 +1,21 @@
.splash-heading {
& hgroup {
& h1 {
font-size: var(--font-size-5xl);
font-weight: bold;
margin-bottom: 0.5rem;
}
& h2 {
font-size: var(--font-size-xl);
margin-bottom: 1.25rem;
font-weight: normal;
}
}
& p {
font-size: var(--font-size-lg);
max-width: 570px;
line-height: 1.5;
}
}

View File

@ -0,0 +1,7 @@
---
import './SplashLinks.scss';
---
<nav class='splash-links'>
<slot></slot>
</nav>

View File

@ -0,0 +1,5 @@
.splash-links {
display: flex;
align-items: center;
column-gap: 20px;
}

View File

@ -0,0 +1,4 @@
export { default as Splash } from './Splash.astro';
export { default as SplashHeading } from './SplashHeading.astro';
export { default as SplashLinks } from './SplashLinks.astro';
export { default as Link } from './Link.astro';

View File

@ -1,5 +1,5 @@
--- ---
import '../styles/prism-one-light.css'; import '@root/styles/prism-one-light.css';
import PageLayout from '@root/layouts/default.astro'; import PageLayout from '@root/layouts/default.astro';
import { Markdown } from 'astro/components'; import { Markdown } from 'astro/components';
import ArticleContent from '@components/ArticleContent'; import ArticleContent from '@components/ArticleContent';

View File

@ -1,91 +1,29 @@
--- ---
import type { ArticleType } from '@root/types'; import type { ArticleType } from '@root/types';
import { Icon } from 'astro-icon';
import * as utils from '@utils/index'; import * as utils from '@utils/index';
import PageLayout from '@layouts/default.astro'; import PageLayout from '@layouts/default.astro';
import RecentArticles from '@components/RecentArticles'; import RecentArticles from '@components/RecentArticles';
import { Splash, SplashHeading, SplashLinks, Link } from '@components/Splash';
const data = await Astro.glob<ArticleType>('../../content/articles/**/*.md'); const data = await Astro.glob<ArticleType>('../../content/articles/**/*.md');
const articles = utils.transformArticles(data); const articles = utils.transformArticles(data);
--- ---
<PageLayout> <PageLayout>
<section class='welcome container'> <Splash>
<header class='welcome-heading'> <SplashHeading>
<hgroup class='welcome-heading__title'> <hgroup>
<h1>Hello, I'am Sergey</h1> <h1>Hello, I'am Sergey</h1>
<h2>Fullstack <b>web-developer</b> & <b>freelancer</b></h2> <h2>Fullstack <b>web-developer</b> & <b>freelancer</b></h2>
</hgroup> </hgroup>
<p class='welcome-heading__description'> <p>Я занимаюсь разработкой веб-сайтов и веб-приложений разной сложности, а также публикую различные статьи и туториалы на разные IT темы.</p>
Я занимаюсь разработкой веб-сайтов и веб-приложений разной сложности, а также публикую </SplashHeading>
различные статьи и туториалы на разные IT темы. <SplashLinks>
</p> <Link icon='information' href='/about'>обо мне</Link>
</header> <Link icon='email_filled' href='/about'>написать мне</Link>
<nav class='welcome-links'> </SplashLinks>
<div class='welcome-links__link'> </Splash>
<Icon name='information' width='18' height='18' />
<a href='/about'> обо мне</a>
</div>
<div class='welcome-links__link'>
<Icon name='email_filled' width='18' height='18' />
<a href='/contacts'> написать мне</a>
</div>
</nav>
</section>
<RecentArticles articles={articles} length={4} /> <RecentArticles articles={articles} length={4} />
<style lang='scss'>
.welcome {
margin-top: 40px;
margin-bottom: 150px;
&-heading {
&__title {
& h1 {
font-size: var(--font-size-5xl);
font-weight: bold;
margin-bottom: 0.5rem;
}
& h2 {
font-size: var(--font-size-xl);
margin-bottom: 1.25rem;
font-weight: normal;
}
}
&__description {
font-size: var(--font-size-lg);
max-width: 570px;
line-height: 1.5;
}
}
&-links {
display: flex;
align-items: center;
column-gap: 20px;
&__link {
display: flex;
align-items: center;
column-gap: 5px;
& a {
color: var(--font-color-gray);
}
}
}
}
[astro-icon='information'] {
fill: var(--color-gray-600);
}
[astro-icon='email_filled'] {
fill: var(--color-gray-600);
}
</style>
</PageLayout> </PageLayout>

View File

@ -97,13 +97,11 @@
--opacity-hover: 0.7; --opacity-hover: 0.7;
} }
/* Text selection */
::selection { ::selection {
background: var(--color-yellow-100); background: var(--color-yellow-100);
color: var(--color-black); color: var(--color-black);
} }
/* Scrollbar */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px; height: 10px;
@ -164,7 +162,6 @@ body {
list-style: none; list-style: none;
} }
/* Buttons */
.btn-link { .btn-link {
cursor: pointer; cursor: pointer;
display: inline-flex; display: inline-flex;