diff --git a/src/components/ArticleCardList.tsx b/src/components/ArticleCardList.tsx index d87a5471..c02a264a 100644 --- a/src/components/ArticleCardList.tsx +++ b/src/components/ArticleCardList.tsx @@ -18,10 +18,6 @@ export const ArticleCardList:React.FC = ({ articles, next } `} - {!prevPage ? null : ( - - )} -
{articles.map((article, i) => { const preview = { @@ -40,8 +36,9 @@ export const ArticleCardList:React.FC = ({ articles, next })}
- {!nextPage ? null : ( - - )} + ) diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx new file mode 100644 index 00000000..39cc8faa --- /dev/null +++ b/src/components/Button/index.tsx @@ -0,0 +1,25 @@ +import './styles.css' +import Link from 'next/link' + +export type ButtonProps = { + style?: React.CSSProperties + href?: string +} + +export const Button: React.FC = props => { + if (props.href) { + return ( + + + {props.children} + + + ) + } + + return ( + + ) +} \ No newline at end of file diff --git a/src/components/Button/styles.css b/src/components/Button/styles.css new file mode 100644 index 00000000..b26b105f --- /dev/null +++ b/src/components/Button/styles.css @@ -0,0 +1,25 @@ +.button { + border: none; + font-size: var(--font-size-default); + + text-align: center; + margin-top: var(--size-m); + margin-bottom: var(--size-m); + margin-left: 1px; + margin-right: 1px; + + padding: var(--size-s) var(--size-m); + border-radius: 100px; + + background-color: var(--color-back); + box-shadow: 0 0 0 1px rgba(27, 51, 88, 0.15); + + transition: box-shadow 150ms; + + outline: none; + cursor: pointer; +} + +.button:hover { + box-shadow: 0 4px 20px rgba(27, 51, 88, 0.15) +} diff --git a/src/components/Pager/index.tsx b/src/components/Pager/index.tsx index fb7ae07d..d349add5 100644 --- a/src/components/Pager/index.tsx +++ b/src/components/Pager/index.tsx @@ -1,28 +1,20 @@ -import './styles.css' - -import Link from 'next/link' - -const text = ['↑', '↓'] -const linkText = ['Предыдущая страница', 'Следующая страница'] - -type Position = 'top' | 'bottom' -const i = (type: Position) => type === 'top' - ? 0 - : 1 +import { Block } from '../Block' +import { Button } from '../Button' +import { Spacer } from '../Spacer' export type PagerProps = { - url: string - position: Position + nextHref: string | null + prevHref: string | null } -export const Pager: React.FC = ({ url, position }) => ( -
- - {text[i(position)]} - - - - {linkText[i(position)]} - -
+export const Pager: React.FC = props => ( + + {!props.prevHref ? null : ( + + )} + + {!props.nextHref ? null : ( + + )} + ) diff --git a/src/components/Pager/styles.css b/src/components/Pager/styles.css deleted file mode 100644 index fd3f6d8e..00000000 --- a/src/components/Pager/styles.css +++ /dev/null @@ -1,9 +0,0 @@ -.pager { - text-align: center; - margin-top: var(--size-m); - margin-bottom: var(--size-m); -} - -.pager .icon { - margin: 0 var(--size-s); -} diff --git a/src/style.css b/src/style.css index 8fbc6450..5df5193a 100644 --- a/src/style.css +++ b/src/style.css @@ -73,6 +73,10 @@ --size-l: 2em; --size-xl: 5em; + /* EFFECTS */ + --radius: 10px; + --shadow: 0 0 0 1px rgba(27, 51, 88, 0.15); + /* MARGINS */ --small-margin: 0.2em; --half-margin: 0.5em;