Skip to content
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

[FE] 街の領域に色を付けるように #608

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/app/components/modules/map/map-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Town = {
name: string;
image: Image;
centerCoordinate: Coordinate;
color: string;
};

const CityObjectImages = [
Expand Down Expand Up @@ -56,10 +57,12 @@ export const TownList = [
name: "チェアタウン",
centerCoordinate: { latitude: 0, longitude: 0 },
image: { src: "/images/town.svg", width: 500, height: 500 },
color: "#FF3600",
},
{
name: "コシカケシティ",
centerCoordinate: { latitude: 300, longitude: 300 },
image: { src: "/images/town.svg", width: 500, height: 500 },
color: "#0089A2",
},
] satisfies Town[];
8 changes: 5 additions & 3 deletions frontend/app/components/modules/map/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const ChairLayer: FC<{
const TownLayer = memo(function TownLayer() {
return (
<div className="flex w-full h-full absolute top-0 left-0 select-none">
{TownList.map(({ centerCoordinate, name, image }) => {
{TownList.map(({ centerCoordinate, name, image, color }) => {
const pos = coordinateToPos(centerCoordinate);
return (
<div
Expand All @@ -282,12 +282,13 @@ const TownLayer = memo(function TownLayer() {
>
<div
role="presentation"
className="absolute rounded-full bg-neutral-100 bg-opacity-40 border-2 border-neutral-200"
className="absolute rounded-full bg-neutral-100 bg-opacity-40 border-4 border-neutral-200"
style={{
width: image.width + 20,
height: image.width + 20,
top: -10,
left: -10,
borderColor: color,
}}
></div>
<img
Expand All @@ -300,7 +301,8 @@ const TownLayer = memo(function TownLayer() {
<div className="absolute bottom-[-54px] w-full text-center">
<Text
tagName="span"
className="px-3 py-1 bg-neutral-400 text-white rounded-md"
className="px-3 py-1 text-white rounded-md"
style={{ backgroundColor: color }}
size="sm"
>
{name}
Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/primitives/text/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type TextProps = PropsWithChildren<{
size?: Size;
variant?: Variant;
className?: string;
style?: React.CSSProperties;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちら不要そうです

}>;

const getSizeClass = (size?: Size) => {
Expand Down