Skip to content

Commit

Permalink
Merge pull request #97 from prgrms-fe-devcourse/72-feature/banner-com…
Browse files Browse the repository at this point in the history
…ponent

72 feature/banner component
  • Loading branch information
thsk3 authored Oct 1, 2024
2 parents 00cb2af + 9a796c4 commit 58e4ca2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Binary file added src/assets/imgs/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/components/Banner/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as S from './styles';

interface BannerProps {
src: string;
width?: number;
height?: number;
}

export const Banner = ({ src, width = 100, height = 30 }: BannerProps) => {
return (
<S.Banner width={width} height={height}>
<img src={src} alt="banner"></img>
</S.Banner>
);
};
22 changes: 22 additions & 0 deletions src/components/Banner/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { styled } from 'styled-components';

export const Banner = styled.div<{ width: number; height: number }>`
position: relative;
width: ${({ width }) => width}%;
padding-top: ${({ height }) => height}%;
max-width: 1280px;
margin: auto;
& > img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
@media (min-width: 1280px) {
padding-top: 300px;
}
`;

0 comments on commit 58e4ca2

Please sign in to comment.