Skip to content

Commit

Permalink
Merge branch 'develop' into feature/feat-optimize-code
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmfou98 authored Oct 16, 2023
2 parents 7058ed0 + baf741f commit 5e13dab
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dependencies:
- '**/yarn.lock'

🙏리뷰해주세요:
- '**'

JURUMARBLE:
- apps/jurumarble/*
- apps/jurumarble/**/*

CHOOZ:
- apps/chooz/*
- apps/chooz/**/*

PACKAGES:
- packages/*
- packages/**/*
14 changes: 14 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Labeler
on:
pull_request:
types: [opened]
pull_request_target:

jobs:
label:
runs-on: ubuntu-latest

steps:
- uses: actions/labeler@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN || github.token }}'
6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ plugins:
spec: "@yarnpkg/plugin-typescript"

packageExtensions:
follow-redirects@*:
dependencies:
debug: "*"
debug@*:
dependencies:
supports-color: "*"
swiper@*:
dependencies:
"@types/react": "^17"
Expand Down
2 changes: 2 additions & 0 deletions apps/jurumarble/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});

console.log("START");
/** @type {import('next').NextConfig} */
const nextConfig = {
swcMinify: true,
Expand All @@ -10,6 +11,7 @@ const nextConfig = {
},
transpilePackages: ["@monorepo/ui, @monorepo/hooks"],
images: {
unoptimized: true,
domains: [
"shopping-phinf.pstatic.net",
"elasticbeanstalk-ap-northeast-2-319210348301.s3.ap-northeast-2.amazonaws.com",
Expand Down
5 changes: 4 additions & 1 deletion apps/jurumarble/src/app/search/components/DrinkItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useDrinkStampService from "services/useDrinkStampService";
import SvgStamp from "src/assets/icons/components/IcStamp";
import { DrinkInfo } from "src/types/drink";
import styled, { css, useTheme } from "styled-components";
import { RatioFrame } from "@monorepo/ui";

interface Props {
drinkInfo: DrinkInfo;
Expand All @@ -26,7 +27,9 @@ function DrinkItem({ drinkInfo, onClickDrinkItem, selectedDrinkList }: Props) {
return (
<Container onClick={onClickDrinkItem} name={name} selected={selectedDrinkList?.includes(name)}>
<ImageWrapper>
<Image alt={name} src={image} fill style={{ borderRadius: "10px" }} />
<RatioFrame ratio="square">
<Image loading="lazy" alt={name} src={image} fill style={{ borderRadius: "10px" }} />
</RatioFrame>
</ImageWrapper>
<InfoContainer>
<NameStampContainer>
Expand Down
1 change: 0 additions & 1 deletion apps/jurumarble/src/components/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const BarItem = styled.div<{ isActive: boolean }>`

const Padding = styled.div`
width: 100%;
height: 63px;
background-color: ${({ theme }) => theme.colors.bg_01};
`;

Expand Down
1 change: 1 addition & 0 deletions packages/ui/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export { default as FloatComponentTemplate } from "./modal/FloatComponentTemplat
export { default as DivideLine } from "./divide/DivideLine";
export * from "./selectBox";
export * from "./swiper";
export * from "./ratioframe";
59 changes: 59 additions & 0 deletions packages/ui/components/ratioframe/RatioFrame.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import styled, { css, type DefaultTheme } from "styled-components";

const baseAspectRatioCss = `
position: relative;
&:before {
content: '';
display: block;
}
> :first-child {
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
width: 100%;
height: 100%;
}
`;

const aspectRatios = {
auto: `
${baseAspectRatioCss}
`,
square: `
${baseAspectRatioCss}
:before {
padding-bottom: calc((100 / 100) * 100%);
} ;
`,
} as const;

export interface RatioFrameProps {
ratio: keyof typeof aspectRatios;
imgAuto?: boolean;
imgCover?: boolean;
className?: string;
children?: React.ReactNode;
}

export const RatioFrame = ({ children, ratio, className, ...rest }: RatioFrameProps) => (
<Container ratio={ratio} className={className} {...rest}>
{children}
</Container>
);

type RatioFrameStyleProps = Pick<RatioFrameProps, "ratio" | "imgAuto" | "imgCover">;

const Container = styled.div<RatioFrameStyleProps>`
${({ ratio, imgAuto, imgCover }) => css`
${ratio && aspectRatios[ratio]}
img {
height: 100%;
${{
...(imgAuto ? { height: "auto" } : {}),
...(imgCover ? { objectFit: "cover" } : {}),
}}
}
`}
`;
1 change: 1 addition & 0 deletions packages/ui/components/ratioframe/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./RatioFrame";

0 comments on commit 5e13dab

Please sign in to comment.