Skip to content

Commit

Permalink
feat: update select popup styles for mobile (#165)
Browse files Browse the repository at this point in the history
* feat: update slect popup styles for mobile

* feat: fix prop
  • Loading branch information
NikitaCG committed Jan 23, 2024
1 parent 9fef024 commit f02f916
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 37 deletions.
155 changes: 125 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@gravity-ui/prettier-config": "^1.1.0",
"@gravity-ui/stylelint-config": "^4.0.1",
"@gravity-ui/tsconfig": "^1.0.0",
"@gravity-ui/uikit": "^5.20.0",
"@gravity-ui/uikit": "^5.25.0",
"@jest/environment": "^29.7.0",
"@storybook/addon-essentials": "^7.0.27",
"@storybook/cli": "^7.0.27",
Expand Down
6 changes: 6 additions & 0 deletions src/components/FeedHeader/components/Controls/Controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ $block: '.#{$namespace}feed-controls';
border-radius: $selectorItemBorderRadius;
}
}

&_isMobile {
@include add-specificity(&) {
max-height: inherit;
}
}
}

&__popup-filter {
Expand Down
7 changes: 5 additions & 2 deletions src/components/FeedHeader/components/Controls/Controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {Button, Icon, Select} from '@gravity-ui/uikit';
*/
import {BlogMetrikaGoalIds} from '../../../../constants';
import {LikesContext} from '../../../../contexts/LikesContext';
import {MobileContext} from '../../../../contexts/MobileContext';
import metrika from '../../../../counters/metrika';
import {MetrikaCounter} from '../../../../counters/utils';
import {Keyset, i18} from '../../../../i18n';
Expand Down Expand Up @@ -61,6 +62,8 @@ export const Controls = ({
const [savedOnly, setSavedOnly] = useState<boolean>(savedOnlyInitial === 'true');
const [search, setSearch] = useState<string>(searchInitial as string);

const isMobile = useContext(MobileContext);

const handleSavedOnly = () => {
handleAnalyticsSaveOnly();
setSavedOnly(!savedOnly);
Expand Down Expand Up @@ -162,7 +165,7 @@ export const Controls = ({
defaultValue={[tagInitial] as string[]}
onUpdate={handleTagSelect}
placeholder={i18(Keyset.AllTags)}
popupClassName={b('popup')}
popupClassName={b('popup', {isMobile})}
renderControl={renderSwitcher({
initial: [tagInitial],
list: tagsItems,
Expand All @@ -185,7 +188,7 @@ export const Controls = ({
disablePortal
options={services}
defaultValue={servicesItems}
popupClassName={b('popup')}
popupClassName={b('popup', {isMobile})}
onUpdate={handleServicesSelect}
placeholder={i18(Keyset.AllServices)}
renderControl={renderSwitcher({
Expand Down
14 changes: 10 additions & 4 deletions src/containers/BlogPage/__stories__/BlogPage.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import type {Meta, StoryFn} from '@storybook/react';
import type {Meta, StoryContext, StoryFn} from '@storybook/react';

import {BlogConstructorProvider} from '../../../constructor/BlogConstructorProvider';
import {GetPostsRequest, Query} from '../../../models/common';
Expand Down Expand Up @@ -45,15 +45,21 @@ export default {
},
} as Meta;

const DefaultTemplate: StoryFn<BlogPageProps> = (args) => (
const WithNavigationTemplate: StoryFn<BlogPageProps> = (args) => (
<BlogConstructorProvider router={routerData}>
<BlogPage {...args} />
</BlogConstructorProvider>
);

export const Default = DefaultTemplate.bind({});
export const Default = {
render: (args: BlogPageProps, {globals}: StoryContext) => (
<BlogConstructorProvider router={routerData} isMobile={globals.platform === 'mobile'}>
<BlogPage {...args} />
</BlogConstructorProvider>
),
};

export const WithNavigation = DefaultTemplate.bind({});
export const WithNavigation = WithNavigationTemplate.bind({});
WithNavigation.args = {
navigation,
} as unknown as BlogPageProps;

0 comments on commit f02f916

Please sign in to comment.