Skip to content

Commit

Permalink
Add event ended button
Browse files Browse the repository at this point in the history
  • Loading branch information
f0reachARR committed Mar 25, 2024
1 parent 4b8e247 commit e25985e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 75 deletions.
23 changes: 0 additions & 23 deletions components/toppage/EntryButton.stories.tsx

This file was deleted.

53 changes: 13 additions & 40 deletions components/toppage/EntryButton.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { css, useTheme } from "@emotion/react";
import Link from "next/link";
import ColorBorderButton from "../buttons/ColorBorderButton";
import { OrgListLink } from "./OrgList";

type EntryButtonProps = {
isMobile: boolean;
hasStampCard: boolean;
};

const container = css`
display: flex;
Expand All @@ -24,46 +18,25 @@ const notice = css`
text-align: center;
`;

const ActivateButton = ({ isMobile, hasStampCard }: EntryButtonProps) => {
const ActivateButton = () => {
const theme = useTheme();

if (isMobile) {
if (hasStampCard) {
return (
<Link href="/stampcard">
<ColorBorderButton
label="スタンプカードを表示"
textColor={theme.colors.button.enable.backgroundColor}
borderColor={theme.colors.button.enable.backgroundColor}
/>
</Link>
);
} else {
return (
<Link href="/diagnose">
<ColorBorderButton
label="診断する"
textColor={theme.colors.button.enable.backgroundColor}
borderColor={theme.colors.button.enable.backgroundColor}
/>
</Link>
);
}
} else {
return (
<>
<ColorBorderButton label="診断する" disabled={true} />
<p css={notice}>診断するにはスマートフォンからアクセスしてください。</p>
</>
);
}
return (
<Link href="/diagnose">
<ColorBorderButton
label="診断する"
textColor={theme.colors.button.enable.backgroundColor}
borderColor={theme.colors.button.enable.backgroundColor}
/>
</Link>
);
};

export default function EntryButton(props: EntryButtonProps) {
export default function EntryButton() {
return (
<div css={container}>
<ActivateButton {...props} />
<OrgListLink />
<ActivateButton />
<p css={notice}>イベントは終了しました!</p>
</div>
);
}
5 changes: 1 addition & 4 deletions components/toppage/EventGuidance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ export default function EventGuidance() {
<h6>開催日</h6>
</td>
<td css={body}>
<p>DAY1 2023年4月18日(火)</p>
<p>DAY2 2023年4月19日(水)</p>
<p>DAY3 2023年4月20日(木)</p>
<p>DAY4 2023年4月21日(金)</p>
<p>イベントは終了しました!</p>
</td>
</tr>
<tr>
Expand Down
9 changes: 1 addition & 8 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import FeatureStampRally from "../components/toppage/FeatureStampRally";
import Hero from "../components/toppage/Hero";
import OrgList from "../components/toppage/OrgList";
import { OrganizationProvider, useOrganizations } from "../hooks/organizations";
import { useRecommendation } from "../hooks/recommendation";
import useUser from "../hooks/user";
import { useIsMobile } from "../store/userAgent";

const OGP_URL = process.env.NEXT_PUBLIC_OGP_URL ?? "http://localhost:8787";

Expand Down Expand Up @@ -80,10 +78,8 @@ export default function Home({
questions,
}: HomeProps) {
const { replace, query } = useRouter();
const { isMobile } = useIsMobile();
// TODO: 相性診断するときにユーザ情報を作成すれば良いので、ここでユーザ情報を作成する必要はない
useUser();
const { data: recommendation } = useRecommendation();

const featureStampRally = {
title: "スタンプラリー",
Expand Down Expand Up @@ -148,10 +144,7 @@ export default function Home({
<Hero />
<div css={container}>
<OrgShowcase orgs={showcaseOrgs} />
<EntryButton
isMobile={isMobile}
hasStampCard={typeof recommendation === "object"}
/>
<EntryButton />

<FeatureDiagnose {...featureDiagnose} />
<FeatureStampRally {...featureStampRally} />
Expand Down

0 comments on commit e25985e

Please sign in to comment.