first commit.
This commit is contained in:
6
src/features/page-title/PageTitle.module.css
Normal file
6
src/features/page-title/PageTitle.module.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.pageTitle {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
font-size: 150%;
|
||||
margin-bottom: 10px;
|
||||
}
|
19
src/features/page-title/PageTitle.tsx
Normal file
19
src/features/page-title/PageTitle.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from "react";
|
||||
import { Helmet } from "react-helmet-async";
|
||||
import { useAppSelector } from "../../app/hooks";
|
||||
import styles from "./PageTitle.module.css";
|
||||
import { selectPageTitle } from "./pageTitleSlice";
|
||||
|
||||
const PageTitle: React.FC = () => {
|
||||
const title = useAppSelector(selectPageTitle);
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>{title} - CelLoc3D Server</title>
|
||||
</Helmet>
|
||||
<div className={styles.pageTitle}>{title}</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default PageTitle;
|
25
src/features/page-title/pageTitleSlice.ts
Normal file
25
src/features/page-title/pageTitleSlice.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { RootState } from "../../app/store";
|
||||
|
||||
export interface PageTitleState {
|
||||
value: string;
|
||||
}
|
||||
|
||||
const initialState: PageTitleState = {
|
||||
value: "",
|
||||
};
|
||||
|
||||
const pageTitleSlice = createSlice({
|
||||
name: "pageTitle",
|
||||
initialState,
|
||||
reducers: {
|
||||
setTitle: (state, action: PayloadAction<string>) => {
|
||||
state.value = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setTitle } = pageTitleSlice.actions;
|
||||
export const selectPageTitle = (state: RootState) => state.pageTitle.value;
|
||||
|
||||
export default pageTitleSlice.reducer;
|
Reference in New Issue
Block a user