Skip to content

Commit

Permalink
feat(select): add select mobile (#1016)
Browse files Browse the repository at this point in the history
* feat(select): add select mobile draft

* feat(bottom-sheet): update-bottom-sheet

Переделка bottom-sheet

* refactor(bottom-sheet): refactor

* test(bottom-sheet): updated tests

* fix(bottom-sheet): bug fixes


Co-authored-by: blackraydev <black2001ray@mail.ru>
  • Loading branch information
reme3d2y and blackraydev authored Apr 13, 2022
1 parent 06f0427 commit b3cfb0d
Show file tree
Hide file tree
Showing 36 changed files with 823 additions and 24 deletions.
20 changes: 18 additions & 2 deletions packages/bottom-sheet/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,21 @@ export type BottomSheetProps = {
*/
contentClassName?: string;

/**
* Дополнительный класс
*/
containerClassName?: string;

/**
* Дополнительный класс шапки
*/
headerClassName?: string;

/**
* Дополнительный класс футера
*/
footerClassName?: string;

/**
* Дополнительный класс для аддонов
*/
Expand Down Expand Up @@ -181,7 +191,9 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
title,
actionButton,
contentClassName,
containerClassName,
headerClassName,
footerClassName,
addonClassName,
closerClassName,
backerClassName,
Expand Down Expand Up @@ -419,7 +431,7 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
{...sheetSwipeablehandlers}
>
<div
className={cn(styles.scrollableContainer, {
className={cn(styles.scrollableContainer, containerClassName, {
[styles.scrollLocked]: scrollLocked,
})}
ref={scrollableContainer}
Expand All @@ -437,7 +449,11 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
{children}
</div>

{actionButton && <Footer sticky={stickyFooter}>{actionButton}</Footer>}
{actionButton && (
<Footer sticky={stickyFooter} className={footerClassName}>
{actionButton}
</Footer>
)}
</div>
</div>
</BaseModal>
Expand Down
3 changes: 2 additions & 1 deletion packages/bottom-sheet/src/components/backer/index.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root {
--bottom-sheet-backer-bg-color: var(--color-light-bg-primary-alpha-40);
--bottom-sheet-backer-bg-color: var(--color-light-bg-primary-inverted-alpha-3);
}

.backer {
Expand All @@ -9,6 +9,7 @@
justify-content: center;
align-items: center;
cursor: pointer;
color: var(--color-light-graphic-primary);
}

.button {
Expand Down
3 changes: 2 additions & 1 deletion packages/bottom-sheet/src/components/closer/index.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root {
--bottom-sheet-closer-bg-color: var(--color-light-bg-primary-alpha-40);
--bottom-sheet-closer-bg-color: var(--color-light-bg-primary-inverted-alpha-3);
}

.closer {
Expand All @@ -9,6 +9,7 @@
justify-content: center;
align-items: center;
cursor: pointer;
color: var(--color-light-graphic-primary);
}

.button {
Expand Down
3 changes: 1 addition & 2 deletions packages/bottom-sheet/src/components/header/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

.header {
display: flex;
align-items: center;
padding: var(--gap-xs);
padding-bottom: 0;
background-color: var(--color-light-bg-primary);
border-top-right-radius: var(--border-radius-xl);
border-top-left-radius: var(--border-radius-xl);
z-index: 1;
}

.sticky {
Expand Down Expand Up @@ -56,7 +56,6 @@
}

.title {
height: 24px;
padding: var(--gap-xs) var(--gap-xs);
margin: var(--bottom-sheet-title-margin-vertical) 0;
width: 100%;
Expand Down
2 changes: 2 additions & 0 deletions packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
},
"dependencies": {
"@alfalab/core-components-button": "^5.1.1",
"@alfalab/core-components-bottom-sheet": "^4.0.1",
"@alfalab/core-components-base-modal": "^4.0.0",
"@alfalab/core-components-checkbox": "^2.7.0",
"@alfalab/core-components-form-control": "^7.4.0",
"@alfalab/core-components-input": "^8.1.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/select/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './arrow';
export * from './base-select';
export * from './select-mobile';
export * from './field';
export * from './optgroup';
export * from './option';
Expand Down
4 changes: 2 additions & 2 deletions packages/select/src/components/optgroup/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { OptgroupProps } from '../../typings';

import styles from './index.module.css';

export const Optgroup = ({ children, label, size = 's' }: OptgroupProps) => (
export const Optgroup = ({ children, className, label, size = 's' }: OptgroupProps) => (
<React.Fragment>
<div className={cn(styles.optgroup, styles[size])}>
<div className={cn(styles.optgroup, className, styles[size])}>
<span className={styles.label}>{label}</span>
</div>
{children}
Expand Down
5 changes: 3 additions & 2 deletions packages/select/src/components/options-list/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const OptionsList = forwardRef(
{
size = 's',
className,
optionGroupClassName,
Option,
getOptionProps,
options = [],
Expand All @@ -43,11 +44,11 @@ export const OptionsList = forwardRef(
const counter = createCounter();
const renderGroup = useCallback(
(group: GroupShape) => (
<Optgroup label={group.label} key={group.label} size={size}>
<Optgroup className={optionGroupClassName} label={group.label} key={group.label} size={size}>
{group.options.map(option => renderOption(option, counter()))}
</Optgroup>
),
[counter, renderOption, size],
[optionGroupClassName, counter, renderOption, size],
);

useVisibleOptions({
Expand Down
Loading

0 comments on commit b3cfb0d

Please sign in to comment.