Skip to content

Commit

Permalink
use camelCase for constants
Browse files Browse the repository at this point in the history
  • Loading branch information
yuheiy committed May 7, 2024
1 parent 0cf8738 commit 4140009
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/components/PageHeader.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import { Image } from 'astro:assets';
import { SITE_TITLE } from '../consts';
import { siteTitle } from '../consts';
interface Props {
title: string;
Expand Down Expand Up @@ -28,7 +28,7 @@ const Title = isHome ? 'p' : 'h1';
src={import('../assets/favicon.svg')}
alt=""
/>
{SITE_TITLE}
{siteTitle}
</a>
</Logo>
</Nav>
Expand Down
10 changes: 5 additions & 5 deletions src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const SITE_TITLE = 'Yuhei Yasuda';
export const SITE_LANG = 'ja';
export const SITE_REGION = 'JP';
export const SITE_TWITTER_ID = '_yuheiy';
export const SITE_DESCRIPTION =
export const siteTitle = 'Yuhei Yasuda';
export const siteLang = 'ja';
export const siteRegion = 'JP';
export const siteTwitterId = '_yuheiy';
export const siteDescription =
'フロントエンドウェブ開発者。HTMLやWAI-ARIA、CSS設計、レスポンシブデザイン、Jamstack、シングルページアプリケーション、アクセシビリティ、インターフェースデザインが関心領域。';
12 changes: 6 additions & 6 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import appleTouchIconImage from '../assets/apple-touch-icon.png';
import faviconImage from '../assets/favicon.svg';
import { SITE_LANG, SITE_REGION, SITE_TITLE, SITE_TWITTER_ID } from '../consts';
import { siteLang, siteRegion, siteTitle, siteTwitterId } from '../consts';
interface BaseProps {
isHome?: false | undefined;
Expand Down Expand Up @@ -35,7 +35,7 @@ const {
twitterCard = 'summary',
} = Astro.props;
const title = isHome ? SITE_TITLE : Astro.props.title;
const title = isHome ? siteTitle : Astro.props.title;
const resolvedOgImage = new URL(ogImage, Astro.site);
let canonicalURL: URL | null = null;
Expand All @@ -53,7 +53,7 @@ if (!is404) {
-->
<html
class="leading-normal underline-offset-[0.125em] @container/root kerning-none [hanging-punctuation:allow-end] [line-break:normal] [overflow-wrap:anywhere] [text-spacing-trim:trim-start] focus-within:motion-safe:scroll-smooth"
lang={SITE_LANG}
lang={siteLang}
>
<head>
{
Expand All @@ -72,16 +72,16 @@ if (!is404) {
{description && <meta name="description" content={description} />}
<meta name="generator" content={Astro.generator} />
<meta name="twitter:card" content={twitterCard} />
<meta name="twitter:site" content={`@${SITE_TWITTER_ID}`} />
<meta name="twitter:site" content={`@${siteTwitterId}`} />
<meta name="twitter:title" content={title} />

<meta property="og:title" content={title} />
<meta property="og:type" content={ogType} />
<meta property="og:image" content={resolvedOgImage} />
{canonicalURL && <meta property="og:url" content={canonicalURL} />}
{description && <meta property="og:description" content={description} />}
<meta property="og:site_name" content={SITE_TITLE} />
<meta property="og:locale" content={`${SITE_LANG}_${SITE_REGION}`} />
<meta property="og:site_name" content={siteTitle} />
<meta property="og:locale" content={`${siteLang}_${siteRegion}`} />

<link rel="alternate" href="/feed" type="application/rss+xml" />
<link rel="apple-touch-icon" href={appleTouchIconImage.src} />
Expand Down
4 changes: 2 additions & 2 deletions src/lib/render-date-to-html.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SITE_LANG, SITE_REGION } from '../consts';
import { siteLang, siteRegion } from '../consts';

const locale = `${SITE_LANG}-${SITE_REGION}`;
const locale = `${siteLang}-${siteRegion}`;

const dateFormatter = new Intl.DateTimeFormat(locale, {
dateStyle: 'long',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/render-year-month-range-to-html.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SITE_LANG, SITE_REGION } from '../consts';
import { siteLang, siteRegion } from '../consts';

interface YearMonth {
year: number;
Expand All @@ -9,7 +9,7 @@ function convertYearMonthToDate({ year, month }: YearMonth) {
return new Date(Date.UTC(year, month - 1));
}

const locale = `${SITE_LANG}-${SITE_REGION}`;
const locale = `${siteLang}-${siteRegion}`;

const yearMonthFormatter = new Intl.DateTimeFormat(locale, {
year: 'numeric',
Expand Down
6 changes: 3 additions & 3 deletions src/pages/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import rss from '@astrojs/rss';
import type { APIContext } from 'astro';
import { getCollection } from 'astro:content';
import invariant from 'tiny-invariant';
import { SITE_DESCRIPTION, SITE_TITLE } from '../consts';
import { siteDescription, siteTitle } from '../consts';
import { getBlogDescription } from '../lib/get-blog-description';

export async function GET(context: APIContext) {
Expand All @@ -25,8 +25,8 @@ export async function GET(context: APIContext) {
.then((promises) => Promise.all(promises));

return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
title: siteTitle,
description: siteDescription,
site: context.site,
items,
trailingSlash: false,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getCollection, getEntry } from 'astro:content';
import type { DetailsListItem } from '../components/DetailsList.astro';
import DetailsList from '../components/DetailsList.astro';
import PageHeader from '../components/PageHeader.astro';
import { SITE_DESCRIPTION, SITE_TITLE } from '../consts';
import { siteDescription, siteTitle } from '../consts';
import Layout from '../layouts/Layout.astro';
import { getBlogDescription } from '../lib/get-blog-description';
import { renderDateToHtml } from '../lib/render-date-to-html';
Expand Down Expand Up @@ -129,10 +129,10 @@ const latestBlogItems = await getCollection('blog')
.then((promises) => Promise.all(promises));
---

<Layout isHome description={SITE_DESCRIPTION}>
<Layout isHome description={siteDescription}>
<PageHeader isHome title="安田 祐平">
<div class="space-y-4 text-dynamic-muted [&_a:any-link]:text-dynamic">
<p>{SITE_DESCRIPTION}</p>
<p>{siteDescription}</p>
<p>
監訳を担当した書籍『<a href={`/${everylayoutEntry.slug}`}
>Every Layout&mdash;&mdash;モジュラーなレスポンシブデザインを実現するCSS設計論</a
Expand Down

0 comments on commit 4140009

Please sign in to comment.