-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ChangelogDialog): change style, add link, events #105
Changes from 5 commits
f3666a4
95e3a8e
4499f51
fb44861
6271710
8f5783d
fb5b9b8
7f91889
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import React from 'react'; | ||
import React, {useEffect} from 'react'; | ||
|
||
import {ArrowUpRightFromSquare} from '@gravity-ui/icons'; | ||
import {Dialog, Icon, Link} from '@gravity-ui/uikit'; | ||
import type {DialogProps} from '@gravity-ui/uikit'; | ||
import {Dialog, Icon, Link} from '@gravity-ui/uikit'; | ||
|
||
import {block} from '../utils/cn'; | ||
|
||
|
@@ -21,7 +21,9 @@ export interface ChangelogDialogProps { | |
items: ChangelogItem[]; | ||
disableBodyScrollLock?: boolean; | ||
disableOutsideClick?: boolean; | ||
onOpen: () => void; | ||
onClose: DialogProps['onClose']; | ||
onLinkClick?: (link: string) => void; | ||
onStoryClick?: (storyId: string) => void; | ||
} | ||
|
||
|
@@ -38,12 +40,19 @@ export function ChangelogDialog({ | |
disableBodyScrollLock = true, | ||
disableOutsideClick, | ||
onClose, | ||
onOpen, | ||
onStoryClick, | ||
onLinkClick, | ||
}: ChangelogDialogProps) { | ||
const idRef = React.useRef<number>(); | ||
idRef.current = idRef.current || getNextId(); | ||
const dialogCaptionId = `changelog-dialog-title-${idRef.current}`; | ||
|
||
useEffect(() => { | ||
if (!open) return; | ||
onOpen(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What the reason to add callback, if you pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like there is no need to keep this code inside the component There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right. |
||
}, [open, onOpen]); | ||
|
||
return ( | ||
<Dialog | ||
className={b()} | ||
|
@@ -72,6 +81,7 @@ export function ChangelogDialog({ | |
className={b('item')} | ||
data={item} | ||
onStoryClick={onStoryClick} | ||
onLinkClick={onLinkClick} | ||
/> | ||
)) | ||
) : ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
@use '../../../variables'; | ||
|
||
$block: '.#{variables.$ns}changelog-dialog-item'; | ||
$metaWidth: 124px; | ||
$metaWidth: 80px; | ||
|
||
#{$block} { | ||
display: flex; | ||
|
@@ -17,17 +17,17 @@ $metaWidth: 124px; | |
} | ||
|
||
&__label-new { | ||
margin-top: 4px; | ||
margin-top: 8px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should use |
||
} | ||
|
||
&__content { | ||
flex: 1; | ||
margin-left: 16px; | ||
margin-left: 20px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace this and other places too. |
||
} | ||
|
||
&__title { | ||
margin: 0; | ||
@include mixins.text-subheader-3(); | ||
@include mixins.text-subheader-2(); | ||
} | ||
|
||
&__image { | ||
|
@@ -40,7 +40,11 @@ $metaWidth: 124px; | |
margin-top: 12px; | ||
} | ||
|
||
&__story-button { | ||
&__button { | ||
margin-top: 16px; | ||
} | ||
|
||
&__button + &__button { | ||
margin-left: 16px; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ export interface ChangelogItem { | |
image?: ImageData; | ||
description: string; | ||
storyId?: string; | ||
link?: string; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove, will do in parent component