diff --git a/front/src/assets/signOut.svg b/front/src/assets/signOut.svg
new file mode 100644
index 0000000..fdaeff6
--- /dev/null
+++ b/front/src/assets/signOut.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/front/src/components/BackHeader.tsx b/front/src/components/BackHeader.tsx
index e8ba89f..dca8c0b 100644
--- a/front/src/components/BackHeader.tsx
+++ b/front/src/components/BackHeader.tsx
@@ -2,22 +2,24 @@ import { Link } from 'react-router-dom'
import { Navbar } from 'react-bootstrap'
import BackButton from '../assets/backArrow.svg'
+import { PropsWithChildren } from 'react'
type BackHeaderProps = {
text: string
}
-function BackHeader({ text }: BackHeaderProps) {
+function BackHeader({ text, children }: PropsWithChildren) {
return (
-
+
{text}
+ {children}
)
}
diff --git a/front/src/components/Points.tsx b/front/src/components/Points.tsx
index fee87ff..184d876 100644
--- a/front/src/components/Points.tsx
+++ b/front/src/components/Points.tsx
@@ -3,7 +3,7 @@ import { CSSProperties } from 'react'
import handStarsIcon from '../assets/handStars.svg'
type PointsProps = {
- points?: number
+ points: number
}
const styles = {
@@ -16,6 +16,7 @@ const styles = {
icon: {
height: 24,
paddingBottom: 5,
+ marginRight: 5,
} as CSSProperties,
}
@@ -23,8 +24,14 @@ function Points({ points }: PointsProps) {
return (
- Набрано очков:
-
{points}
+ Набрано очков:
+
+
+ {points}
+
)
diff --git a/front/src/components/SignOut.tsx b/front/src/components/SignOut.tsx
new file mode 100644
index 0000000..9e01c3c
--- /dev/null
+++ b/front/src/components/SignOut.tsx
@@ -0,0 +1,22 @@
+import { Navbar } from 'react-bootstrap'
+import { Link } from 'react-router-dom'
+import { CSSProperties } from 'react'
+
+import { clearToken } from '../utils/auth'
+
+import signOutIcon from '../assets/signOut.svg'
+
+const styles = {
+ rightIcon: {
+ marginLeft: '1rem',
+ marginRight: 0
+ } as CSSProperties,
+}
+
+const SignOut = () => (
+
+
+
+)
+
+export default SignOut
diff --git a/front/src/components/index.ts b/front/src/components/index.ts
index 6d26007..4ec2ca0 100644
--- a/front/src/components/index.ts
+++ b/front/src/components/index.ts
@@ -11,3 +11,4 @@ export { default as BackHeader } from './BackHeader'
export { default as CategoryPreview } from './CategoryPreview'
export { default as StoriesPreview } from './StoriesPreview'
export { default as Points } from './Points'
+export { default as SignOut } from './SignOut'
diff --git a/front/src/pages/UserPage.tsx b/front/src/pages/UserPage.tsx
index 8d8b310..7ba9603 100644
--- a/front/src/pages/UserPage.tsx
+++ b/front/src/pages/UserPage.tsx
@@ -1,9 +1,8 @@
import { Container } from 'react-bootstrap'
-import BackHeader from '../components/BackHeader'
import { useUser } from '../hooks/api'
import { userCategories } from '../assets/userCategories'
-import { CategoryPreview, Points } from '../components'
+import { BackHeader, CategoryPreview, Points, SignOut } from '../components'
import { gotError } from '../hooks/useFetch'
function UserPage() {
@@ -12,11 +11,16 @@ function UserPage() {
return (
-
+ )
+ }>
+
+
+
+
{userCategories.map(cat => (
))}
diff --git a/front/src/utils/auth.ts b/front/src/utils/auth.ts
index 0f37b67..65fac6e 100644
--- a/front/src/utils/auth.ts
+++ b/front/src/utils/auth.ts
@@ -73,4 +73,4 @@ function getId() {
}
}
-export { getToken, setToken, getId }
+export { getToken, setToken, clearToken, getId }