-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added ArticleNavigation component, which provides next/prev nav…
…igation between articles
- Loading branch information
Aleksei
committed
Jan 15, 2024
1 parent
2960c4d
commit dacad10
Showing
11 changed files
with
295 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@use '~@gravity-ui/page-constructor/styles/variables.scss' as pcVariables; | ||
@use '../../variables.scss'; | ||
|
||
$block: '.#{variables.$ns}article-navigations'; | ||
|
||
#{$block} { | ||
display: flex; | ||
gap: 24px; | ||
&__item { | ||
display: flex; | ||
align-items: center; | ||
gap: 12px; | ||
width: 100%; | ||
border-radius: 16px; | ||
border: 1px solid rgba(255, 255, 255, 0.2); | ||
padding: 4px; | ||
&_full { | ||
justify-content: space-between; | ||
padding-left: 20px; | ||
} | ||
&-button { | ||
width: 56px; | ||
height: 100%; | ||
border-radius: 11px; | ||
overflow: hidden; | ||
} | ||
} | ||
} |
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,52 @@ | ||
import {ArrowLeft, ArrowRight} from '@gravity-ui/icons'; | ||
import {Button, Flex, Icon, Text} from '@gravity-ui/uikit'; | ||
import {block} from 'src/utils'; | ||
|
||
const b = block('article-navigations'); | ||
|
||
import './ArticleNavigations.scss'; | ||
|
||
interface ArticleNavigationsProps { | ||
previousTitle: string; | ||
nextTitle: string; | ||
nextHandler: () => void; | ||
prevHandler: () => void; | ||
} | ||
|
||
export const ArticleNavigations = ({ | ||
previousTitle, | ||
nextTitle, | ||
nextHandler, | ||
prevHandler, | ||
}: ArticleNavigationsProps) => { | ||
return ( | ||
<div className={b()}> | ||
<div className={b('item')}> | ||
<Button onClick={prevHandler} className={b('item-button')} width="max"> | ||
<Icon data={ArrowLeft} size={16} /> | ||
</Button> | ||
<Flex direction="column" gap="1" style={{padding: '8px 0'}}> | ||
<Text variant="body-short" color="light-complementary"> | ||
Previous | ||
</Text> | ||
<Text variant="body-2" color="primary"> | ||
{previousTitle} | ||
</Text> | ||
</Flex> | ||
</div> | ||
<div className={b('item', {full: true})}> | ||
<Flex direction="column" gap="1" style={{padding: '8px 0'}}> | ||
<Text variant="body-short" color="light-complementary"> | ||
Next | ||
</Text> | ||
<Text variant="body-2" color="primary"> | ||
{nextTitle} | ||
</Text> | ||
</Flex> | ||
<Button onClick={nextHandler} className={b('item-button')} width="max"> | ||
<Icon data={ArrowRight} size={16} /> | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
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 @@ | ||
export {ArticleNavigations} from './ArticleNavigations'; |
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
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
Oops, something went wrong.