Skip to content

Commit

Permalink
change components to folder structure (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoMadera authored Jul 15, 2023
1 parent 8db1bb8 commit 3b92565
Show file tree
Hide file tree
Showing 207 changed files with 293 additions and 118 deletions.
5 changes: 1 addition & 4 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { StorybookConfig } from "@storybook/nextjs";

const config: StorybookConfig = {
stories: [
"../stories/**/*.mdx",
"../(stories|components)/**/*.stories.@(js|jsx|ts|tsx)",
],
stories: ["../(stories|components)/**/*.stories.@(js|jsx|ts|tsx|mdx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/ArtistList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./ArtistList";
export * from "./ArtistList";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { Meta, StoryFn } from "@storybook/react";

import { BigPill } from "../components";
import { BigPill } from "components";

export default {
title: "Components/BigPill",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/BigPill/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./BigPill";
export * from "./BigPill";
File renamed without changes.
2 changes: 2 additions & 0 deletions components/BrowseCategories/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./BrowseCategories";
export * from "./BrowseCategories";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./Button";
export * from "./Button";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/CardContainer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CardContainer";
export * from "./CardContainer";
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/CardContent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CardContent";
export * from "./CardContent";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactElement, useCallback } from "react";

import { useRouter } from "next/router";

import EmbedModal from "./EmbedModal";
import { EmbedModal } from "components";
import { CardType } from "components/CardContent";
import { useContextMenu, useToast, useTranslations } from "hooks";
import { menuContextStyles } from "styles/menuContextStyles";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { useRouter } from "next/router";

import CardContentContextMenu from "../CardContentContextMenu";
import { CardContentContextMenu } from "components";
import { CardType } from "components/CardContent";
import { AppContextProvider } from "context/AppContextProvider";
import { ICardContentContextMenuData } from "types/contextMenu";
Expand Down Expand Up @@ -44,7 +44,7 @@ describe("cardContentContextMenu", () => {
const push = jest.fn();
(useRouter as jest.Mock).mockImplementation(() => ({
asPath: "/",
push: mocks?.push || push,
push: mocks?.push ?? push,
query: {
country: "US",
},
Expand Down
2 changes: 2 additions & 0 deletions components/CardContentContextMenu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CardContentContextMenu";
export * from "./CardContentContextMenu";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactElement } from "react";

import { CardType } from "./CardContent";
import SubTitle from "./SubTitle";
import { SubTitle } from "components";
import { CardType } from "components/CardContent";
import { useTranslations } from "hooks";
import { IMappedAlbumItems } from "pages/artist/[artistId]";

Expand All @@ -10,7 +10,10 @@ interface ICardSubTitle {
item: IMappedAlbumItems | SpotifyApi.ArtistObjectFull;
}

export function CardSubTitle({ type, item }: ICardSubTitle): ReactElement {
export default function CardSubTitle({
type,
item,
}: ICardSubTitle): ReactElement {
const { translations } = useTranslations();

if (type === CardType.ALBUM && "album_type" in item) {
Expand Down
2 changes: 2 additions & 0 deletions components/CardSubTitle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CardSubTitle";
export * from "./CardSubTitle";
4 changes: 2 additions & 2 deletions components/CardTrack/CardTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export enum CardType {
Playlist = "playlist",
Album = "album",
}
interface CardTrackProps {
interface ICardTrackProps {
track: ITrack | undefined;
accessToken: string | undefined;
playlistUri: string;
Expand Down Expand Up @@ -79,7 +79,7 @@ function CardTrack({
uri,
visualPosition,
uris,
}: CardTrackProps): ReactElement | null {
}: ICardTrackProps): ReactElement | null {
const {
allTracks,
deviceId,
Expand Down
3 changes: 2 additions & 1 deletion components/CardTrack/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as CardTrack } from "./CardTrack";
export { default } from "./CardTrack";
export * from "./CardTrack";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactElement, useLayoutEffect, useRef, useState } from "react";

import Link from "next/link";

import EmbedModal from "./EmbedModal";
import { EmbedModal } from "components";
import {
useAuth,
useContextMenu,
Expand Down
2 changes: 2 additions & 0 deletions components/CardTrackContextMenu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CardTrackContextMenu";
export * from "./CardTrackContextMenu";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ComponentProps, PropsWithChildren } from "react";
import React, { ComponentProps, PropsWithChildren, ReactElement } from "react";

import { Meta, StoryFn } from "@storybook/react";

Expand Down Expand Up @@ -51,7 +51,7 @@ const Template: StoryFn<
...args
}: { boxWidth: number; totalBoxes: number } & ComponentProps<
typeof Carousel
>) => JSX.Element
>) => ReactElement
> = (args) => {
const { boxWidth, totalBoxes, ...carouselProps } = args;

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/Carousel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./Carousel";
export * from "./Carousel";
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { ReactElement } from "react";

import { CardType } from "./CardContent";
import Carousel from "./Carousel";
import PresentationCard from "./PresentationCard";
import { CardSubTitle } from "components";
import { CardSubTitle, Carousel, PresentationCard } from "components";
import { CardType } from "components/CardContent";
import { IMappedAlbums } from "pages/artist/[artistId]";

interface ICarouselCards {
Expand All @@ -12,7 +10,7 @@ interface ICarouselCards {
type: CardType;
}

export function CarouselCards({
export default function CarouselCards({
items,
title,
type,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render, screen } from "@testing-library/react";
import { NextRouter, useRouter } from "next/router";

import { CarouselCards } from "components";
import { CardType } from "components/CardContent";
import { CarouselCards } from "components/CarouselCards";
import { AppContextProvider } from "context/AppContextProvider";
import { useAuth, useOnScreen } from "hooks";
import { IMappedAlbumItems } from "pages/artist/[artistId]";
Expand Down
2 changes: 2 additions & 0 deletions components/CarouselCards/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CarouselCards";
export * from "./CarouselCards";
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react";

import CheckBoxControl from "components/CheckBoxControl";
import { CheckBoxControl } from "components";

describe("checkboxControl", () => {
it("default render", () => {
Expand Down
2 changes: 2 additions & 0 deletions components/CheckBoxControl/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./CheckBoxControl";
export * from "./CheckBoxControl";
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react";

import ContentContainer from "components/ContentContainer";
import { ContentContainer } from "components";

describe("contentContainer", () => {
it("renders main container with children", () => {
Expand Down
2 changes: 2 additions & 0 deletions components/ContentContainer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./ContentContainer";
export * from "./ContentContainer";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { Meta, StoryFn } from "@storybook/react";

import { playlists } from "./mocks";
import { playlists } from "../mocks";
import { ContextMenu } from "components";

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import {

import { createPortal } from "react-dom";

import CardContentContextMenu, {
ICardContentContextMenu,
} from "./CardContentContextMenu";
import CardTrackContextMenu from "./CardTrackContextMenu";
import { CardContentContextMenu, CardTrackContextMenu } from "components";
import { ICardContentContextMenu } from "components/CardContentContextMenu";
import { useContextMenu, useEventListener } from "hooks";
import { ITrack } from "types/spotify";
import {
Expand Down
2 changes: 2 additions & 0 deletions components/ContextMenu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./ContextMenu";
export * from "./ContextMenu";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/DeviceConnectControl/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./DeviceConnectControl";
export * from "./DeviceConnectControl";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/EditPlaylistDetails/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./EditPlaylistDetails";
export * from "./EditPlaylistDetails";
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { ReactElement, useEffect, useState } from "react";

import SelectControl from "./SelectControl";
import { Button, CheckBoxControl, TextControl } from "components";
import {
Button,
CheckBoxControl,
SelectControl,
TextControl,
} from "components";
import { useToast, useToggle, useTranslations } from "hooks";
import { ToastMessage } from "utils";

Expand Down
2 changes: 2 additions & 0 deletions components/EmbedModal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./EmbedModal";
export * from "./EmbedModal";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/EpisodeCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./EpisodeCard";
export * from "./EpisodeCard";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/ExplicitSign/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./ExplicitSign";
export * from "./ExplicitSign";
36 changes: 0 additions & 36 deletions components/Eyebrow.tsx

This file was deleted.

58 changes: 58 additions & 0 deletions components/Eyebrow/Eyebrow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { PropsWithChildren, ReactElement } from "react";

interface EyebrowProps {
size?: "small" | "medium" | "large";
}

const eyebrowStyles: Record<
Required<EyebrowProps>["size"],
React.CSSProperties
> = {
small: {
fontSize: "12px",
marginBottom: "0px",
fontWeight: "400",
color: "#e5e5e5",
},
medium: {
fontSize: "0.95rem",
marginBottom: "5px",
fontWeight: "400",
color: "#fff",
},
large: {
fontSize: "1.5rem",
marginBottom: "12px",
fontWeight: "700",
color: "#fff",
},
};

export default function Eyebrow({
children,
size = "small",
}: PropsWithChildren<EyebrowProps>): ReactElement {
const eyebrowStyle = eyebrowStyles[size] || eyebrowStyles.large;

return (
<p
className="eyebrow"
style={{
fontSize: eyebrowStyle.fontSize,
marginBottom: eyebrowStyle.marginBottom,
fontWeight: eyebrowStyle.fontWeight,
color: eyebrowStyle.color,
}}
>
{children}
<style jsx>
{`
.eyebrow {
margin-top: 4px;
padding: 0.08em 0px;
}
`}
</style>
</p>
);
}
2 changes: 2 additions & 0 deletions components/Eyebrow/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./Eyebrow";
export * from "./Eyebrow";
File renamed without changes.
2 changes: 2 additions & 0 deletions components/FeatureCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./FeatureCard";
export * from "./FeatureCard";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { Meta, StoryFn } from "@storybook/react";

import { track } from "./mocks";
import { track } from "../mocks";
import { FirstTrackContainer } from "components";

export default {
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions components/FirstTrackContainer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./FirstTrackContainer";
export * from "./FirstTrackContainer";
File renamed without changes.
2 changes: 2 additions & 0 deletions components/FollowButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./FollowButton";
export * from "./FollowButton";
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions components/Footer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./Footer";
export * from "./Footer";
File renamed without changes.
2 changes: 2 additions & 0 deletions components/FormToggle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./FormToggle";
export * from "./FormToggle";
File renamed without changes.
2 changes: 2 additions & 0 deletions components/FullScreenControl/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./FullScreenControl";
export * from "./FullScreenControl";
Loading

1 comment on commit 3b92565

@vercel
Copy link

@vercel vercel bot commented on 3b92565 Jul 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.