Skip to content

Commit

Permalink
newをyamlモード
Browse files Browse the repository at this point in the history
  • Loading branch information
eatski committed Aug 11, 2024
1 parent c148ced commit 85b6841
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 31 deletions.
21 changes: 21 additions & 0 deletions src/app/stories/new/_components/NewStorySwitchMode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { type Device } from "@/common/util/device";
import { NewStory } from "@/components/newStory";
import { NewStoryYaml } from "@/components/newStoryYaml";
import { StoryInit } from "@/server/model/story";
import { useSearchParams } from "next/navigation";

export const NewStorySwitchMode = ({
device,
createStory,
}: {
device: Device;
createStory: (data: StoryInit) => Promise<string>;
}) => {
const searchParams = useSearchParams();
const mode = searchParams?.get("mode");
if (mode === "yaml") {
return <NewStoryYaml createStory={createStory} />;
} else {
return <NewStory device={device} createStory={createStory} />;
}
};
2 changes: 1 addition & 1 deletion src/app/stories/new/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Device, getDevice } from "@/common/util/device";
import { getDevice } from "@/common/util/device";
import { NewStory } from "@/components/newStory";
import { getUserSession } from "@/server/serverComponent/getUserSession";
import { createStory } from "@/server/services/story/createStory";
Expand Down
29 changes: 0 additions & 29 deletions src/app/stories/new/yaml/page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/newStory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const NewStory: React.FC<Props> = ({ device, createStory }) => {
<Heading level={1}>新しいストーリーを投稿</Heading>
{device === "desktop" && (
<div className={styles.navigation}>
<Link href={`/stories/new/yaml`}>
<Link href={`/stories/new?mode=yaml`}>
<GenericButton color={"zero"} size={"small"}>
<ButtonIconWrapper>
<AiOutlineUpload />
Expand Down

0 comments on commit 85b6841

Please sign in to comment.