-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
1,478 additions
and
2,287 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
This file was deleted.
Oops, something went wrong.
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,54 @@ | ||
import React, { useMemo } from 'react'; | ||
import { Button, ButtonSize, ButtonType, Icon, IconType } from 'ekb'; | ||
import { useCopyHref } from 'shared/helpers/useCopyHref'; | ||
|
||
type Props = { | ||
coordinates?: [number, number] | number[]; | ||
}; | ||
|
||
const COPY_RESET_TIMEOUT = 2000; | ||
|
||
export function CardActions({ coordinates }: Props) { | ||
const { isCopied: isLinkCopied, onCopy: onCopyLink } = useCopyHref( | ||
window.location.href, | ||
COPY_RESET_TIMEOUT, | ||
); | ||
|
||
const coordsString = useMemo(() => { | ||
if (!coordinates) { | ||
return null; | ||
} | ||
|
||
const coords = Array.isArray(coordinates[0]) ? coordinates[0] : coordinates; | ||
|
||
return `${coords[0]?.toFixed(6)}, ${coords[1]?.toFixed(6)}`; | ||
}, [coordinates]); | ||
|
||
const { isCopied: isCoordsCopied, onCopy: onCopyCoords } = useCopyHref( | ||
coordsString, | ||
COPY_RESET_TIMEOUT, | ||
); | ||
|
||
return ( | ||
<> | ||
{coordsString && ( | ||
<Button | ||
type={ButtonType.DEFAULT} | ||
size={ButtonSize.SMALL} | ||
onClick={onCopyCoords} | ||
postfix={<Icon type={IconType.Copy} />} | ||
> | ||
{isCoordsCopied ? 'Скопировано' : coordsString} | ||
</Button> | ||
)} | ||
<Button | ||
type={ButtonType.DEFAULT} | ||
size={ButtonSize.SMALL} | ||
onClick={onCopyLink} | ||
postfix={<Icon type={IconType.Link} />} | ||
> | ||
{isLinkCopied ? 'Скопировано' : 'Ссылка на объект'} | ||
</Button> | ||
</> | ||
); | ||
} |
38 changes: 0 additions & 38 deletions
38
components/Card/components/ConstructionInfo/ConstructionInfo.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { ComponentProps, useCallback, useEffect, useState } from 'react'; | ||
import { Checkbox, ListGrid, ListGridItem } from 'ekb'; | ||
|
||
export type IFilterGridItem = Partial<ComponentProps<typeof ListGridItem>> & { | ||
type: string; | ||
color?: string; | ||
}; | ||
|
||
interface Props { | ||
selectedByDefault?: string[]; | ||
items?: IFilterGridItem[]; | ||
onChange?: (state: string[]) => void; | ||
} | ||
|
||
export function FilterGrid({ items, onChange, selectedByDefault = [] }: Props) { | ||
const [selected, setSelected] = useState<string[]>(selectedByDefault); | ||
|
||
const toggle = useCallback( | ||
(type: string) => { | ||
if (selected.includes(type)) { | ||
setSelected(selected.filter((s) => s !== type)); | ||
} else { | ||
setSelected(selected.concat(type)); | ||
} | ||
}, | ||
[selected], | ||
); | ||
|
||
useEffect(() => { | ||
onChange?.(selected); | ||
}, [onChange, selected]); | ||
|
||
return ( | ||
<ListGrid> | ||
{items.map(({ type, subTitle, description, color }) => ( | ||
<ListGridItem | ||
key={type} | ||
subTitle={subTitle} | ||
description={description} | ||
prefix={ | ||
<Checkbox | ||
isSelected={selected.includes(type)} | ||
activeColor={color} | ||
toggle={() => toggle(type)} | ||
/> | ||
} | ||
> | ||
{type} | ||
</ListGridItem> | ||
))} | ||
</ListGrid> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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.
7c1168b
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.
Deploy preview for map ready!
✅ Preview
https://map-7owrwzll3-ekbdev.vercel.app
https://ekbdev-map-refactor3.vercel.app
Built with commit 7c1168b.
This pull request is being automatically deployed with vercel-action