-
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 #81 from brklntmhwk/80-add-unpic-image-related-lib
feat(ui): 🆕 refactor image and card components
- Loading branch information
Showing
168 changed files
with
467 additions
and
371 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"assets":{"images":{}},"src":{"assets":{"images":{}},"components":{"card":{}},"content":{"page":{"en":{}}}}} | ||
{"assets":{"images":{}},"src":{"assets":{"images":{}},"components":{"card":{}},"content":{"page":{"en":{}}},"lib":{"unified":{"plugins":{}}}}} |
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
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Footer/Footer.astro → src/components/common/Footer/Footer.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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/components/LocalePicker/LocalePicker.tsx → ...ents/common/LocalePicker/LocalePicker.tsx
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.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
src/components/Navigation/Navigation.astro → ...onents/common/Navigation/Navigation.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
File renamed without changes.
File renamed without changes.
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
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,48 +1,57 @@ | ||
--- | ||
import { Picture } from 'astro:assets'; | ||
import type { HTMLAttributes } from 'astro/types'; | ||
type Props = HTMLAttributes<'figure'> & { | ||
'data-image-alt'?: string; | ||
'data-image-aspect-ratio'?: string; | ||
'data-image-blur-url'?: string; | ||
type Props = Omit<HTMLAttributes<'picture'>, 'alt' | 'src'> & { | ||
alt: string; | ||
placeholder: string; | ||
src: string | ImageMetadata; | ||
}; | ||
const { | ||
'data-image-alt': alt, | ||
'data-image-aspect-ratio': aspectRatio, | ||
'data-image-blur-url': blurUrl, | ||
...props | ||
} = Astro.props; | ||
const { alt, placeholder, src, ...props } = Astro.props; | ||
--- | ||
|
||
<figure class="image-figure" {...props}> | ||
<div class="image-wrapper"> | ||
<slot /> | ||
</div> | ||
<figcaption>{alt}</figcaption> | ||
</figure> | ||
<style define:vars={{ aspectRatio, blurUrl }}> | ||
.image-figure { | ||
{ | ||
typeof src === 'string' ? ( | ||
<img {alt} {src} {...props} /> | ||
) : ( | ||
<figure> | ||
<Picture | ||
{alt} | ||
{src} | ||
class="image" | ||
formats={['avif']} | ||
widths={[240, 540, 720, src.width]} | ||
pictureAttributes={{ | ||
style: { | ||
aspectRatio: `${src.width} / ${src.height}`, | ||
margin: "0 auto", | ||
maxHeight: "100%" | ||
} | ||
}} | ||
{...props} | ||
/> | ||
<figcaption>{alt}</figcaption> | ||
</figure> | ||
) | ||
} | ||
<style define:vars={{ blurUrl: `url(${placeholder})` }}> | ||
figure { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.35rem; | ||
gap: 0.375rem; | ||
place-items: center; | ||
margin: 1.75rem 0; | ||
.image-wrapper { | ||
margin: 0 auto; | ||
max-height: 100%; | ||
aspect-ratio: var(--aspectRatio); | ||
& :global(img) { | ||
object-fit: contain; | ||
color: transparent; | ||
background-image: var(--blurUrl); | ||
background-size: cover; | ||
background-position: 50%; | ||
background-repeat: no-repeat; | ||
} | ||
} | ||
figcaption { | ||
font-size: 0.95rem; | ||
} | ||
} | ||
figcaption { | ||
font-size: 0.95rem; | ||
} | ||
.image { | ||
object-fit: contain; | ||
color: transparent; | ||
background-image: var(--blurUrl); | ||
background-size: cover; | ||
background-position: 50% 50%; | ||
background-repeat: no-repeat; | ||
} | ||
</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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as Figure } from './Figure.astro'; | ||
export { default as Image } from './Image.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
src/components/BlogList/BlogList.astro → ...components/models/BlogList/BlogList.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Pager/Pager.astro → src/components/models/Pager/Pager.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Toc/TocDrawer.astro → src/components/models/Toc/TocDrawer.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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Balloon/Balloon.astro → src/components/ui/Balloon/Balloon.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...omponents/BuyMeACoffee/BuyMeACoffee.astro → ...onents/ui/BuyMeACoffee/BuyMeACoffee.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ponents/ContactForm/Checkbox/Checkbox.tsx → ...ents/ui/ContactForm/Checkbox/Checkbox.tsx
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.
2 changes: 1 addition & 1 deletion
2
src/components/ContactForm/ContactForm.tsx → ...components/ui/ContactForm/ContactForm.tsx
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Likes/Likes.tsx → src/components/ui/Likes/Likes.tsx
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.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Modal/modal.css.ts → src/components/ui/Modal/modal.css.ts
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
2 changes: 1 addition & 1 deletion
2
...omponents/PhotoGallery/PhotoGallery.astro → ...onents/ui/PhotoGallery/PhotoGallery.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
Oops, something went wrong.