Giter VIP home page Giter VIP logo

kyutify-next's Introduction

Spotify clone with Next.js 13.5.2 ๐Ÿš

์‹คํ–‰๋ฐฉ๋ฒ•

npm install

npm run dev

๋งŒ๋“œ๋Š” ๊ณผ์ •

1. Layout ์žก๊ธฐ

๊ธฐ์กด์˜ airbnb์™€๋Š” ๋‹ค๋ฅด๊ฒŒ, app ๋””๋ ‰ํ† ๋ฆฌ ํ•˜์œ„์— ๋ฐ”๋กœ page.tsx๋ฅผ ์œ„์น˜ ์‹œํ‚จ๊ฒŒ ์•„๋‹Œ, (site)๋ผ๋Š” ๋””๋ ‰ํ† ๋ฆฌ ํ•˜์œ„์— page.tsx๋ฅผ ์œ„์น˜ ์‹œ์ผฐ๋‹ค.

์ „์ฒด์ ์ธ Layout์€ Layout.tsx์— ์ž‘์„ฑ์„ ํ•˜์˜€๋‹ค.

// app/layout.tsx

import './globals.css';
import type { Metadata } from 'next';
import { Figtree } from 'next/font/google';

import SideBar from '@/components/SideBar';

const font = Figtree({ subsets: ['latin'] });

export const metadata: Metadata = {
  title: 'Spotify Clone',
  description: 'Listen to music!',
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang='en'>
      <body className={font.className}>
        <SideBar>{children}</SideBar>
      </body>
    </html>
  );
}

SideBar.tsx์— ์ „์ฒด์ ์ธ ๋ ˆ์ด์•„์›ƒ์ด ์žกํ˜€์žˆ๋‹ค. ์ถ”๊ฐ€๋กœ tailwind-merge๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ธฐ๋ณธ์ ์ธ ์Šคํƒ€์ผ ์†์„ฑ์„ ๋ฏธ๋ฆฌ ์„ ์–ธํ•ด๋‘๊ณ , ์ถ”๊ฐ€๋กœ ํ•„์š”ํ•œ CSS ์†์„ฑ์€ props์˜ className๋กœ ๋„˜๊ฒจ ๊ธฐ์กด ์Šคํƒ€์ผ์„ ํ™•์žฅ์‹œํ‚ค๊ฑฐ๋‚˜, ์˜ค๋ฒ„๋ผ์ด๋”ฉ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.

const Button = forwardRef<HTMLButtonElement, ButtonProps>(
  ({ className, children, disabled, type = 'button', ...props }, ref) => {
    return (
      <button
        type={type}
        className={twMerge(
          `
        w-full
        rounded-full
        bg-green-500
        border
        border-transparent
        px-3
        py-3
        disabled:cursor-not-allowed
        disabled:opacity-50
        text-black
        font-bold
        hover:opacity-75
        transition
      `,
          className
        )}
        disabled={disabled}
        ref={ref}
        {...props}
      >
        {children}
      </button>
    );
  }
);
Button.displayName = 'Button';

export default Button;

๋ณด๋Š” ๊ฒƒ์ฒ˜๋Ÿผ twMerge()ํ•จ์ˆ˜ ๋‚ด๋ถ€์— ๋ฏธ๋ฆฌ ์ง€์ •ํ•ด ๋†“์„ CSS์†์„ฑ์„ ์ž…๋ ฅํ•ด ๋†“๋Š”๋‹ค.

kyutify-next's People

Contributors

kokyusik91 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.