-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from PerryM123/develop
ver0.2を開発
- Loading branch information
Showing
17 changed files
with
481 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// libraries | ||
import { useState, useEffect, MouseEventHandler } from "react"; | ||
import { NextPage } from "next"; | ||
import { useDispatch } from "react-redux"; | ||
// interface | ||
import { HeaderType } from "../interfaces/frameData"; | ||
// reducer | ||
import { updateFrameDataList } from "../reducer/frameDataSlice"; | ||
// style | ||
import styles from "../styles/frameDataTableHeader.module.css"; | ||
interface Props { | ||
type: | ||
| HeaderType.START_UP | ||
| HeaderType.BLOCK | ||
| HeaderType.HIT | ||
| HeaderType.COUNTER; | ||
title: string; | ||
} | ||
|
||
const Logo = { | ||
ASCENDING: "▲", | ||
DESCENDING: "▼", | ||
}; | ||
|
||
const ClickableHeader: NextPage<Props> = (props) => { | ||
const { type, title } = props; | ||
const [isActive, setActive] = useState(false); | ||
const [isAscending, setAscending] = useState(false); | ||
const [isDescending, setDescending] = useState(false); | ||
const [iconText, setIconText] = useState(Logo.DESCENDING); | ||
const dispatch = useDispatch(); | ||
|
||
const clickTableIcon = () => { | ||
dispatch(updateFrameDataList({ type, isAscending, isDescending })); | ||
if (!isActive) { | ||
setActive(!isActive); | ||
setAscending(true); | ||
} else if (!isAscending) { | ||
setAscending(true); | ||
setDescending(false); | ||
setIconText(Logo.DESCENDING); | ||
} else if (isAscending && !isDescending) { | ||
setAscending(false); | ||
setDescending(true); | ||
setIconText(Logo.ASCENDING); | ||
} | ||
}; | ||
|
||
const reset = () => { | ||
setActive(false); | ||
setAscending(false); | ||
setDescending(false); | ||
}; | ||
|
||
const tableIconClassName = [styles.tableIcon]; | ||
if (isActive) { | ||
tableIconClassName.push(styles.jsActive); | ||
} | ||
|
||
return ( | ||
<th onClick={clickTableIcon} className={styles.changeOrder}> | ||
{title}{" "} | ||
<span | ||
className={`${styles.tableIcon} ${isActive && styles["js-active"]}`} | ||
> | ||
{iconText} | ||
</span> | ||
</th> | ||
); | ||
}; | ||
|
||
export default ClickableHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import '../styles/globals.css' | ||
import type { AppProps } from 'next/app' | ||
import "../styles/globals.css"; | ||
import type { AppProps } from "next/app"; | ||
import { Provider } from "react-redux"; | ||
import { createStore } from "./../store/basicStore"; | ||
|
||
export default function App({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} /> | ||
return ( | ||
<Provider store={createStore}> | ||
<Component {...pageProps} /> | ||
</Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.