-
Notifications
You must be signed in to change notification settings - Fork 14
feat(Gallery): add Gallery component #247
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
Conversation
Preview is ready. |
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.
src/components/FilesGallery/components/VideoFileView/VideoFileView.tsx
Outdated
Show resolved
Hide resolved
src/components/FilesGallery/__stories__/FilesGallery.stories.tsx
Outdated
Show resolved
Hide resolved
@kseniya57 Do we have rfc fo this components? |
Yes |
401a5d6
to
8c07955
Compare
855b632
to
772a07f
Compare
src/components/Gallery/components/views/ImageView/ImageView.tsx
Outdated
Show resolved
Hide resolved
Storybook tests fail. Please try to update the branch |
The branch is already up to date, so seems like the problem is in the main or in the ci. I will try to rerun, but I also did that a week ago. |
513124e
to
070ce7f
Compare
78cb8b3
to
9bf19d6
Compare
src/components/Gallery/Gallery.scss
Outdated
} | ||
} | ||
|
||
#{$filePreviewBlock} { |
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.
Is it able to not modify the internal styles of another component? It's not safe
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.
We need the new compact view for that component to avoid this
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.
Relying on class names is not safe, especially from another package, because these names are "private" data, they could change in any minor update. The best solution here is to add flexibility to the FilePreview
either through props or CSS API.
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.
Created a pull request: gravity-ui/uikit#2157
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.
Used the compact view property and removed this custom styles
src/components/Gallery/Gallery.scss
Outdated
.g-root_theme_light, | ||
.g-root_theme_light-hc { | ||
#{$block}__header { | ||
background-color: var(--g-color-private-white-450); |
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.
Private variables are not for the usage in components. It should be changed to semantic variables, which already have colors in both light/dark themes
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.
I looked through all the colors and didn't find a suitable one, the thing is that this color should be black transparent in a dark theme and light transparent in a light one. Also the color should match the background of the gallery, but be transparent.
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.
Private variables are potential subject of change in future minor releases, the color might change or even the variable itself might be deleted. If these colors needs to be added to the list of semantic color they should be validated with the design team. Or you can use plain colors here
export type UseNavigationProps = { | ||
itemsCount: number; | ||
initialItemIndex?: number; | ||
selectedPreviewItemClass: 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.
It's better use refs list for targeting DOM node. We can replace two props itemsCount
and selectedPreviewItemClass
with itemRefs: React.Ref[]
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.
Isn't this a more resource-intensive approach? So you need to create a ref for each element, and there can be many elements.
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.
I am sure it's not. Refs are the React way of manipulation DOM
const ImagesGalleryTemplate: StoryFn<GalleryProps> = () => { | ||
const [open, setOpen] = React.useState(false); | ||
|
||
const container = usePortalContainer(); |
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 specify container? usePortalContainer returns the default one anyway
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.
I think it was a bug fix, but I can't remember that bug, maybe it was related to the old uikit version
Add the components for rendering galleries (base gallery and the files gallery with file previews and some pre-defined active file renderers)