diff --git a/.vscode/settings.json b/.vscode/settings.json index 94f559b..e1d88cd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,5 +17,8 @@ "editor.formatOnSave": true, "editor.formatOnSaveMode": "file", "eslint.format.enable": true, - "cSpell.words": [] + "cSpell.words": [], + "[typescriptreact]": { + "editor.defaultFormatter": "vscode.typescript-language-features" + } } diff --git a/src/assets/poster.png b/src/assets/poster.png new file mode 100644 index 0000000..2b003e7 Binary files /dev/null and b/src/assets/poster.png differ diff --git a/src/components/Card/index.tsx b/src/components/Card/index.tsx index bc4b7f6..773bfd0 100644 --- a/src/components/Card/index.tsx +++ b/src/components/Card/index.tsx @@ -14,49 +14,31 @@ export const Card = ({ celebrity, level, visible }: CardProps) => { const history = useHistory() - const levelMapping: Record = { - 0: { size: 20, s: 2 }, - 1: { size: 30, s: 3 }, - 2: { size: 40, s: 4 }, - 3: { size: 60, s: 6 }, - 4: { size: 80, s: 8 }, - 5: { size: 100, s: 10 }, - 6: { size: 120, s: 12 }, - 7: { size: 140, s: 14 }, - 8: { size: 180, s: 18 }, - } + // getCssColorByCelebrity({ celebrity, border: true }) return ( diff --git a/src/components/Controls/index.tsx b/src/components/Controls/index.tsx index d91b54f..5268fe2 100644 --- a/src/components/Controls/index.tsx +++ b/src/components/Controls/index.tsx @@ -49,45 +49,5 @@ export const Controls = ({ )} -
- - -
) diff --git a/src/components/Grid/index.tsx b/src/components/Grid/index.tsx index 53b09d6..78ee5ec 100644 --- a/src/components/Grid/index.tsx +++ b/src/components/Grid/index.tsx @@ -2,15 +2,23 @@ import React from 'react' import { data } from '../../data/data' import { Celebrity } from '../../types' +import { clsx, getCssColorByStatus } from '../../utils' import { Card } from '../Card' import { Controls } from '../Controls' import { SearchInput } from '../SearchInput' -export const Grid = () => { - const [level, setLevel] = React.useState(6) - const [visible, setVisible] = React.useState(true) - const [query, setQuery] = React.useState('') - const [status, setStatus] = React.useState(null) +export type GridProps = { + query: string + setQuery: (value: string) => void + visible: boolean + setVisible: (value: boolean) => void + level: number + setLevel: (value: number) => void + status: Celebrity['status'] | null + setStatus: (value: Celebrity['status'] | null) => void +} + +export const Grid = ({ query, setQuery, visible, setVisible, level, setLevel, status, setStatus }: GridProps) => { const { celebrities } = data const renderBoxes = () => @@ -26,19 +34,16 @@ export const Grid = () => { }) return ( -
- {renderBoxes()} +
+
+ {renderBoxes()} +
-
) -} +} \ No newline at end of file diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx new file mode 100644 index 0000000..294c939 --- /dev/null +++ b/src/components/Header/index.tsx @@ -0,0 +1,32 @@ +import React from 'react' +import { useHistory } from 'react-router-dom' +import { Celebrity } from '../../types' +import { clsx, getCssColorByCelebrity } from '../../utils' +import { SearchInput } from '../SearchInput' + +export type HeaderProps = { + query: string + setQuery: (value: string) => void + status: Celebrity['status'] | null + setStatus: (value: Celebrity['status'] | null) => void +} + +export const Header = ({ query, setQuery, status, setStatus }: HeaderProps) => { + const history = useHistory() + + return ( +
+
+

Celebrity Wall

+
+ +
+
+
+ ) +} diff --git a/src/components/Hero/index.tsx b/src/components/Hero/index.tsx new file mode 100644 index 0000000..5067756 --- /dev/null +++ b/src/components/Hero/index.tsx @@ -0,0 +1,68 @@ +import React from 'react' +import { useHistory } from 'react-router-dom' +import { clsx, getCssColorByStatus } from '../../utils' +import MahsaAminiHero from '../../assets/poster.png' +import { SearchInput } from '../SearchInput' +import { Celebrity } from '../../types' + +export type HeroProps = { + query: string + setQuery: (value: string) => void + status: Celebrity['status'] | null + setStatus: (value: Celebrity['status'] | null) => void +} + +export const Hero = ({ query, setQuery, status, setStatus }: HeroProps) => { + const history = useHistory() + + return ( +
+
+
+
+
+
+

Celebrity Wall

+

Rate the Celebrities

+

+ The goal of this project is to provide a big picture of celebrities + and their stance regarding what is happening in Iran. +

+
+ +
+ + + +
+
+
+
+ Mahsa Amini Poster +
+
+
+
+ ) +} diff --git a/src/components/SearchInput/index.tsx b/src/components/SearchInput/index.tsx index 327f375..7059af9 100644 --- a/src/components/SearchInput/index.tsx +++ b/src/components/SearchInput/index.tsx @@ -1,24 +1,27 @@ import React from 'react' +import { clsx } from '../../utils' import { StatusFilterProps, StatusFilter } from './StatusFilter' export type SearchInputProps = { query: string setQuery: (value: string) => void - filter: StatusFilterProps + filter: StatusFilterProps, + theme: string } export const SearchInput = ({ query, setQuery, filter: { status, setStatus }, + theme = 'light', }: SearchInputProps) => { const onChange = (event: { target: { value: string } }) => { setQuery(event?.target?.value) } return ( -
- -
+
+ {/* */} +
-
-

Celebrity Wall

-
-

- The goal of this project is to provide a big picture of celebrities - and their stance regarding what is happening in Iran. -

-

-

- Green celebrities -

{' '} - supported the cause,{' '} -

- gray celebrities -

{' '} - didn't react to the cause, and{' '} -

- red celebrities -

{' '} - are against the cause! -

-
+export const HomePage = () => { + const [level, setLevel] = React.useState(6) + const [visible, setVisible] = React.useState(true) + const [query, setQuery] = React.useState('') + const [status, setStatus] = React.useState(null) + + return ( +
+
+ +
- -
-) + ) +} \ No newline at end of file diff --git a/src/utils/colors.ts b/src/utils/colors.ts index ae83edf..40c6822 100644 --- a/src/utils/colors.ts +++ b/src/utils/colors.ts @@ -10,9 +10,9 @@ export const getCssColorByStatus = (options: { const { status, background, text, border } = options return clsx([ status === 'GOOD' && [ - background && 'bg-green-500', - text && 'text-green-500', - border && 'border-green-500', + background && 'bg-emerald-500', + text && 'text-emerald-500', + border && 'border-emerald-500', ], status === 'BAD' && [ background && 'bg-red-500',