Skip to content

Commit

Permalink
色んなサイズの画像を最適化
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-20 committed Mar 23, 2024
1 parent 2178989 commit de83bcd
Show file tree
Hide file tree
Showing 131 changed files with 11 additions and 16 deletions.
5 changes: 2 additions & 3 deletions workspaces/app/src/features/book/components/BookCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Flex } from '../../../foundation/components/Flex';
import { Image } from '../../../foundation/components/Image';
import { Link } from '../../../foundation/components/Link';
import { Text } from '../../../foundation/components/Text';
import { useImage } from '../../../foundation/hooks/useImage';
import { Color, Radius, Space, Typography } from '../../../foundation/styles/variables';

const _Wrapper = styled(Link)`
Expand Down Expand Up @@ -38,8 +37,8 @@ type Props = {
};

const BookCard: React.FC<Props> = ({ book }) => {
const imageUrl = useImage({ height: 128, imageId: book.image.id, width: 192 });
const authorImageUrl = useImage({ height: 32, imageId: book.author.image.id, width: 32 });
const imageUrl = `/raw-images/${book.image.id}_288x407.avif`;
const authorImageUrl = `/raw-images/${book.author.image.id}_32x32.avif`;

return (
<_Wrapper href={`/books/${book.id}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Flex } from '../../../foundation/components/Flex';
import { Image } from '../../../foundation/components/Image';
import { Link } from '../../../foundation/components/Link';
import { Text } from '../../../foundation/components/Text';
import { useImage } from '../../../foundation/hooks/useImage';
import { Color, Radius, Space, Typography } from '../../../foundation/styles/variables';

const _Wrapper = styled(Link)`
Expand Down Expand Up @@ -49,8 +48,8 @@ type Props = {
};

const FeatureCard: React.FC<Props> = ({ book }) => {
const imageUrl = useImage({ height: 96, imageId: book.image.id, width: 96 });
const authorImageUrl = useImage({ height: 32, imageId: book.author.image.id, width: 32 });
const imageUrl = `/raw-images/${book.image.id}_144x204.avif`;
const authorImageUrl = `/raw-images/${book.author.image.id}_32x32.avif`;

return (
<_Wrapper href={`/books/${book.id}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { Link } from '../../../foundation/components/Link';
import { Separator } from '../../../foundation/components/Separator';
import { Spacer } from '../../../foundation/components/Spacer';
import { Text } from '../../../foundation/components/Text';
import { useImage } from '../../../foundation/hooks/useImage';
import { Color, Radius, Space, Typography } from '../../../foundation/styles/variables';

const _Wrapper = styled.li`
Expand Down Expand Up @@ -43,8 +42,8 @@ type Props = {
};

const RankingCard: React.FC<Props> = ({ book }) => {
const imageUrl = useImage({ height: 96, imageId: book.image.id, width: 96 });
const authorImageUrl = useImage({ height: 32, imageId: book.author.image.id, width: 32 });
const imageUrl = `/raw-images/${book.image.id}_144x204.avif`;
const authorImageUrl = `/raw-images/${book.author.image.id}_32x32.avif`;

return (
<_Wrapper>
Expand Down
3 changes: 1 addition & 2 deletions workspaces/app/src/pages/AuthorDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Image } from '../../foundation/components/Image';
import { Separator } from '../../foundation/components/Separator';
import { Spacer } from '../../foundation/components/Spacer';
import { Text } from '../../foundation/components/Text';
import { useImage } from '../../foundation/hooks/useImage';
import { Color, Space, Typography } from '../../foundation/styles/variables';

const _HeadingWrapper = styled.section`
Expand All @@ -37,7 +36,7 @@ const AuthorDetailPage: React.FC = () => {

const { data: author } = useAuthor({ params: { authorId } });

const imageUrl = useImage({ height: 128, imageId: author.image.id, width: 128 });
const imageUrl = `/raw-images/${author.image.id}_128x128.avif`;
const bookListA11yId = useId();

return (
Expand Down
9 changes: 4 additions & 5 deletions workspaces/app/src/pages/BookDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Link } from '../../foundation/components/Link';
import { Separator } from '../../foundation/components/Separator';
import { Spacer } from '../../foundation/components/Spacer';
import { Text } from '../../foundation/components/Text';
import { useImage } from '../../foundation/hooks/useImage';
import { Color, Space, Typography } from '../../foundation/styles/variables';

import { BottomNavigator } from './internal/BottomNavigator';
Expand Down Expand Up @@ -54,8 +53,8 @@ const BookDetailPage: React.FC = () => {

const [isFavorite, toggleFavorite] = useAtom(FavoriteBookAtomFamily(bookId));

const bookImageUrl = useImage({ height: 256, imageId: book.image.id, width: 192 });
const auhtorImageUrl = useImage({ height: 32, imageId: book.author.image.id, width: 32 });
const bookImageUrl = `/raw-images/${book.image.id}_288x407.avif`;
const authorImageUrl = `/raw-images/${book.author.image.id}_32x32.avif`;

const handleFavClick = useCallback(() => {
toggleFavorite();
Expand Down Expand Up @@ -83,9 +82,9 @@ const BookDetailPage: React.FC = () => {
<Spacer height={Space * 1} />

<_AuthorWrapper href={`/authors/${book.author.id}`}>
{auhtorImageUrl != null && (
{authorImageUrl != null && (
<_AvatarWrapper>
<Image alt={book.author.name} height={32} objectFit="cover" src={auhtorImageUrl} width={32} />
<Image alt={book.author.name} height={32} objectFit="cover" src={authorImageUrl} width={32} />
</_AvatarWrapper>
)}
<Text color={Color.MONO_100} typography={Typography.NORMAL14}>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit de83bcd

Please sign in to comment.