-
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.
Merge pull request #110 from Kartore/feat/ui-design
デザイン変更
- Loading branch information
Showing
92 changed files
with
354 additions
and
226 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:[email protected]&display=swap" rel="stylesheet"> | ||
<title>Vite + React + TS</title> | ||
</head> | ||
<body> | ||
|
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,11 @@ | ||
import type { HTMLAttributes } from 'react'; | ||
|
||
export type {{pascalCase name}}Props = HTMLAttributes<SVGElement>; | ||
|
||
const {{pascalCase name}} = (props: {{pascalCase name}}Props) => { | ||
return <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" {...props}></svg>; | ||
}; | ||
|
||
{{pascalCase name}}.displayName = '{{pascalCase name}}'; | ||
|
||
export { {{pascalCase name}} }; |
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { ComponentPropsWithoutRef, FC } from 'react'; | ||
import { useState } from 'react'; | ||
|
||
import type { DragEndEvent, DragStartEvent, Modifier, UniqueIdentifier } from '@dnd-kit/core'; | ||
import type { DragEndEvent, DragStartEvent, Modifier } from '@dnd-kit/core'; | ||
import { | ||
DndContext, | ||
DragOverlay, | ||
|
@@ -12,29 +12,32 @@ import { | |
useSensors, | ||
} from '@dnd-kit/core'; | ||
import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'; | ||
import type { LayerSpecification } from 'maplibre-gl'; | ||
import type { LayerSpecification, StyleSpecification } from 'maplibre-gl'; | ||
import { createPortal } from 'react-dom'; | ||
|
||
import { SortableLayerTreeItem } from '~/components/editor/LayerPanel/SortableLayerTreeItem/SortableLayerTreeItem.tsx'; | ||
import { SortableLayerTreeItem } from '~/components/editor/NavigationPanel/SortableLayerTreeItem/SortableLayerTreeItem.tsx'; | ||
import { cn } from '~/utils/tailwindUtil'; | ||
|
||
type LayerPanelProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & { | ||
layers: LayerSpecification[]; | ||
mapStyle: StyleSpecification; | ||
selectedLayerId: LayerSpecification['id'] | null; | ||
onClickLayer: (id: LayerSpecification) => void; | ||
onChangeLayerOrder: (layers: LayerSpecification[]) => void; | ||
}; | ||
|
||
export const LayerPanel: FC<LayerPanelProps> = ({ | ||
export const NavigationPanel: FC<LayerPanelProps> = ({ | ||
onChangeLayerOrder, | ||
onClickLayer, | ||
layers, | ||
mapStyle, | ||
className, | ||
selectedLayerId, | ||
...props | ||
}) => { | ||
const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null); | ||
const [activeLayer, setActiveLayer] = useState<LayerSpecification | null>(null); | ||
|
||
const handleDragStart = ({ active: { id } }: DragStartEvent) => { | ||
setActiveId(id); | ||
setActiveLayer(mapStyle.layers.find((layer) => layer.id === id) || null); | ||
|
||
document.body.style.setProperty('cursor', 'grabbing'); | ||
}; | ||
|
||
|
@@ -47,7 +50,7 @@ export const LayerPanel: FC<LayerPanelProps> = ({ | |
if (!over) { | ||
return; | ||
} | ||
const clonedLayers: LayerSpecification[] = JSON.parse(JSON.stringify(layers)); | ||
const clonedLayers: LayerSpecification[] = JSON.parse(JSON.stringify(mapStyle.layers)); | ||
|
||
const activeIndex = clonedLayers.findIndex((layer) => layer.id === active.id); | ||
const overIndex = clonedLayers.findIndex((layer) => layer.id === over.id); | ||
|
@@ -56,7 +59,7 @@ export const LayerPanel: FC<LayerPanelProps> = ({ | |
}; | ||
|
||
const resetState = () => { | ||
setActiveId(null); | ||
setActiveLayer(null); | ||
|
||
document.body.style.setProperty('cursor', ''); | ||
}; | ||
|
@@ -78,11 +81,25 @@ export const LayerPanel: FC<LayerPanelProps> = ({ | |
); | ||
|
||
return ( | ||
<div {...props} className={cn('h-full w-auto', className)}> | ||
<div className={'border-b py-1 px-2'}> | ||
<div | ||
{...props} | ||
className={cn( | ||
'flex h-auto w-auto flex-col rounded-lg border border-gray-300 bg-white', | ||
className | ||
)} | ||
> | ||
<div className={'flex flex-col gap-2 border-b border-b-gray-300 py-4 px-4'}> | ||
<h1 className={'font-[Montserrat] font-bold'}>Kartore</h1> | ||
<h2 className={'font-[Montserrat] font-semibold'}>{mapStyle.name}</h2> | ||
Check failure on line 93 in src/components/editor/NavigationPanel/NavigationPanel.tsx GitHub Actions / testsrc/components/editor/NavigationPanel/NavigationPanel.test.tsx > Component: NavigationPanel > Snapshot > Default
|
||
</div> | ||
<div | ||
className={ | ||
'border-b border-b-gray-300 py-2 px-4 font-[Montserrat] text-sm font-medium text-gray-500' | ||
} | ||
> | ||
<h2>Layers</h2> | ||
</div> | ||
<div className={'px-2'}> | ||
<div className={'flex-1 overflow-auto'}> | ||
<DndContext | ||
measuring={{ | ||
droppable: { | ||
|
@@ -95,15 +112,16 @@ export const LayerPanel: FC<LayerPanelProps> = ({ | |
onDragEnd={handleDragEnd} | ||
> | ||
<SortableContext | ||
items={layers.map((layer) => layer.id)} | ||
items={mapStyle.layers.map((layer) => layer.id)} | ||
strategy={verticalListSortingStrategy} | ||
> | ||
{layers.map((layer) => { | ||
{mapStyle.layers.map((layer) => { | ||
return ( | ||
<SortableLayerTreeItem | ||
key={layer.id} | ||
id={layer.id} | ||
indicator={layer.id === activeId} | ||
isSelected={layer.id === selectedLayerId} | ||
layer={layer} | ||
indicator={layer.id === activeLayer?.id} | ||
onClick={() => { | ||
onClickLayer(layer); | ||
}} | ||
|
@@ -113,10 +131,10 @@ export const LayerPanel: FC<LayerPanelProps> = ({ | |
</SortableContext> | ||
{createPortal( | ||
<DragOverlay modifiers={[adjustTranslate]}> | ||
{activeId ? <SortableLayerTreeItem id={activeId} clone /> : null} | ||
{activeLayer ? <SortableLayerTreeItem layer={activeLayer} clone /> : null} | ||
</DragOverlay>, | ||
document.body, | ||
`drag-overlay-${activeId}` | ||
`drag-overlay-${activeLayer?.id}` | ||
)} | ||
</DndContext> | ||
</div> | ||
|
16 changes: 10 additions & 6 deletions
16
...rTreeItem/LayerTreeItem/LayerTreeItem.tsx → ...rTreeItem/LayerTreeItem/LayerTreeItem.tsx
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
File renamed without changes.
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 @@ | ||
export * from './NavigationPanel.tsx'; |
1 change: 0 additions & 1 deletion
1
src/components/editor/PropertiesPanel/BackgroundLayerPropertiesPanel/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/components/editor/PropertiesPanel/CircleLayerPropertiesPanel/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/components/editor/PropertiesPanel/FillExtrusionLayerPropertiesPanel/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/components/editor/PropertiesPanel/FillLayerPropertiesPanel/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/components/editor/PropertiesPanel/HeatmapLayerPropertiesPanel/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/components/editor/PropertiesPanel/HillshadeLayerPropertiesPanel/index.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.