Skip to content

Commit

Permalink
feat: phone mocks use correct viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
Pettor committed Feb 24, 2024
1 parent 56aed40 commit 4b03dfe
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const MockBrowser = {
export const MockPhone = {
args: commonProps,
decorators: [MockPhoneDecorator],
parameters: { viewport: { defaultViewport: "iphonex" } },
} satisfies Story;

export const MockWindow = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentProps, ReactElement } from "react";
import { ImageEditor } from "../library/image-editor/Editor";
import { ImageEditor } from "../../library/image-editor/Editor";
import { BasicLayout } from "~/components/layout/BasicLayout";

export interface EditorViewProps extends ComponentProps<typeof ImageEditor> {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const MockBrowser = {
export const MockPhone = {
args: commonProps,
decorators: [MockPhoneDecorator],
parameters: { viewport: { defaultViewport: "iphonex" } },
} satisfies Story;

export const MockWindow = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from "react";
import { BasicLayout } from "../layout/BasicLayout";
import { BasicLayout } from "../../layout/BasicLayout";

export interface ErrorViewProps {
message?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default meta;
type Story = StoryObj<typeof meta>;

const commonProps = {
socialLinkProps: {
onGithubClick: () => console.log("Github"),
onLinkedInClick: () => console.log("Linkedin"),
},
themeSwitchProps: {
mode: "light",
onSwitch: () => console.log("Switched"),
Expand All @@ -35,6 +39,7 @@ export const MockBrowser = {
export const MockPhone = {
args: commonProps,
decorators: [MockPhoneDecorator],
parameters: { viewport: { defaultViewport: "iphonex" } },
} satisfies Story;

export const MockWindow = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { ReactElement } from "react";
import { GithubIcon } from "../icons/GithubIcon";
import { LinkedInIcon } from "../icons/LinkedInIcon";
import { Dropzone } from "../library/dropzone/Dropzone";
import { ThemeSwitch, type ThemeSwitchProps } from "../library/theme-controller/ThemeSwitch";
import LogoImageSrc from "~/assets/images/logo/Logo180.png";
import { GithubIcon } from "~/components/icons/GithubIcon";
import { LinkedInIcon } from "~/components/icons/LinkedInIcon";
import type { SocialLinkProps } from "~/components/layout/BasicLayout";
import { BasicLayout } from "~/components/layout/BasicLayout";
import { Dropzone } from "~/components/library/dropzone/Dropzone";
import type { ThemeSwitchProps } from "~/components/library/theme-controller/ThemeSwitch";
import { ThemeSwitch } from "~/components/library/theme-controller/ThemeSwitch";

export interface HomeViewProps {
themeSwitchProps: ThemeSwitchProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const MockBrowser = {
export const MockPhone = {
args: commonProps,
decorators: [MockPhoneDecorator],
parameters: { viewport: { defaultViewport: "iphonex" } },
} satisfies Story;

export const MockWindow = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { NotFoundView as Component } from "./NotFoundView";
import { NotFoundView as Component } from "../not-found/NotFoundView";
import { FullSizeDecorator } from "~/stories/decorators/FullSizeDecorator";
import { MockBrowserDecorator } from "~/stories/decorators/MockBrowserDecorator";
import { MockPhoneDecorator } from "~/stories/decorators/MockPhoneDecorator";
Expand All @@ -23,6 +23,7 @@ export const MockBrowser = {

export const MockPhone = {
decorators: [MockPhoneDecorator],
parameters: { viewport: { defaultViewport: "iphonex" } },
} satisfies Story;

export const MockWindow = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from "react";
import { BasicLayout } from "../layout/BasicLayout";
import { BasicLayout } from "../../layout/BasicLayout";

export function NotFoundView(): ReactElement {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/core/routes/GlobalRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function GlobalRoutes(): RouteProps[] {
},
{
path: "/editor",
lazy: () => import("~/pages/image-editor/ImageEditorRoute"),
lazy: () => import("~/pages/editor/ImageEditorRoute"),
},
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { ReactElement } from "react";
import { useNavigate } from "react-router-dom";
import { ImageEditor } from "~/components/library/image-editor/Editor";
import { useThemeSwitcher } from "~/components/library/theme-controller/UseThemeSwitcher";
import { ErrorView } from "~/components/views/ErrorView";
import { LoadingView } from "~/components/views/LoadingView";
import { ErrorView } from "~/components/views/error/ErrorView";
import { LoadingView } from "~/components/views/loading/LoadingView";

export interface ImageEditorPageProps {
url: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactElement } from "react";
import { useAtomValue } from "jotai";
import { ImageEditorPage } from "./ImageEditorPage";
import { ErrorView } from "~/components/views/ErrorView";
import { ErrorView } from "~/components/views/error/ErrorView";
import { downloadUrlAtom } from "~/core/routes/atoms/DroppedFileAtoms";

export function Component(): ReactElement {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactElement } from "react";
import { useHomePage } from "./UseHomePage";
import { HomeView } from "~/components/views/HomeView";
import { HomeView } from "~/components/views/home/HomeView";

export function HomePage(): ReactElement {
const homeViewProps = useHomePage();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/HomeRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactElement } from "react";
import { HomePage } from "./HomePage";
import { ErrorView } from "~/components/views/ErrorView";
import { ErrorView } from "~/components/views/error/ErrorView";

export function Component(): ReactElement {
return <HomePage />;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/UseHomePage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useSetAtom } from "jotai";
import { useNavigate } from "react-router-dom";
import { useThemeSwitcher } from "~/components/library/theme-controller/UseThemeSwitcher";
import type { HomeViewProps } from "~/components/views/HomeView";
import type { HomeViewProps } from "~/components/views/home/HomeView";
import { droppedFileAtom } from "~/core/routes/atoms/DroppedFileAtoms";

export function useHomePage(): HomeViewProps {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/not-found/NotFoundPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from "react";
import { NotFoundView } from "~/components/views/NotFoundView";
import { NotFoundView } from "~/components/views/not-found/NotFoundView";

export function NotFoundPage(): ReactElement {
return <NotFoundView />;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/not-found/NotFoundRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactElement } from "react";
import { redirect } from "react-router-dom";
import { NotFoundPage } from "./NotFoundPage";
import { ErrorView } from "~/components/views/ErrorView";
import { ErrorView } from "~/components/views/error/ErrorView";

export function loader(): Response {
// For now redirect to root
Expand Down
2 changes: 1 addition & 1 deletion src/stories/decorators/MockPhoneDecorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { StoryFn } from "@storybook/react";
export function MockPhoneDecorator(Story: StoryFn): ReactElement {
return (
<div className="flex flex-1 justify-center">
<div className="m-8">
<div className="m-8 item">
<div className="mockup-phone">
<div className="camera"></div>
<div className="display">
Expand Down

0 comments on commit 4b03dfe

Please sign in to comment.