-
Notifications
You must be signed in to change notification settings - Fork 0
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 #57 from OUCC/ciffelia/feat-author-image
画像と著者のアイコンに使用できる画像フォーマットを増やす
- Loading branch information
Showing
40 changed files
with
163 additions
and
294 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,21 @@ | ||
--- | ||
import Icon from '@/components/common/Icon.astro' | ||
import { unreachable } from '@/utils/unreachable' | ||
import type { CollectionEntry } from 'astro:content' | ||
import defaultImage from '@/assets/avatar.svg' | ||
import Image from '@/components/common/Image.astro' | ||
type Props = CollectionEntry<'authors'>['data'] & { size: number } | ||
const { size, ...author } = Astro.props | ||
const image = | ||
author.image.type === 'svg' && | ||
author.image.name === 'default_user' && | ||
author.github | ||
? ({ | ||
type: 'external-url', | ||
url: `https://github.com/${author.github}.png`, | ||
} as const) | ||
: author.image | ||
const src = | ||
author.image ?? author.github !== undefined | ||
? `https://github.com/${author.github}.png` | ||
: defaultImage | ||
--- | ||
|
||
{ | ||
image.type === 'svg' ? ( | ||
<Icon | ||
name={image.name} | ||
alt={`${author.name} のアイコン`} | ||
class="aspect-square rounded-full" | ||
height={size} | ||
width={size} | ||
isBlog | ||
/> | ||
) : image.type === 'external-url' ? ( | ||
<img | ||
src={image.url} | ||
alt={`${author.name} のアイコン`} | ||
height={size} | ||
width={size} | ||
class="aspect-square rounded-full" | ||
/> | ||
) : ( | ||
unreachable(image) | ||
) | ||
} | ||
<Image | ||
src={src} | ||
alt={`${author.name} のアイコン`} | ||
class="aspect-square rounded-full" | ||
width={size} | ||
height={size} | ||
/> |
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
{ | ||
"name": "Arduino", | ||
"image": { | ||
"type": "svg", | ||
"name": "arduino" | ||
} | ||
"image": "./arduino.svg" | ||
} |
File renamed without changes
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
{ | ||
"name": "Astro", | ||
"image": { | ||
"type": "svg", | ||
"name": "astro-icon-dark" | ||
} | ||
"image": "./astro.svg" | ||
} |
File renamed without changes
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
File renamed without changes
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
{ | ||
"name": "Discord Bot", | ||
"image": { | ||
"type": "svg", | ||
"name": "discord-mark-black" | ||
} | ||
"image": "./discord-bot.svg" | ||
} |
File renamed without changes
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
{ | ||
"name": "Docker", | ||
"image": { | ||
"type": "svg", | ||
"name": "docker" | ||
} | ||
"image": "./docker.svg" | ||
} |
File renamed without changes
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
{ | ||
"name": ".NET", | ||
"image": { | ||
"type": "svg", | ||
"name": "dotnet-logo" | ||
} | ||
"image": "./dotnet.svg" | ||
} |
File renamed without changes
Oops, something went wrong.