Skip to content

Commit

Permalink
feature/CE-632-Add-labels-to-toggle/button-between-list-and-map-view (#…
Browse files Browse the repository at this point in the history
…408)

Co-authored-by: Barrett Falk <[email protected]>
Co-authored-by: afwilcox <[email protected]>
  • Loading branch information
3 people authored May 1, 2024
1 parent 15ca6b5 commit b2a3c63
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
21 changes: 17 additions & 4 deletions frontend/src/app/components/common/map-list-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ interface Props {
}

const MapListToggle: React.FC<Props> = ({ activeView, onToggle, className }) => {
const setElementActive = (classPrefix: string, viewType: string): string => {
const result = `${classPrefix} ` + (activeView === viewType ? "active" : "");
return result;
};

return (
<ToggleButtonGroup
className={className}
Expand All @@ -24,17 +29,25 @@ const MapListToggle: React.FC<Props> = ({ activeView, onToggle, className }) =>
title="Complaint List View"
value="list"
id="list_toggle_id"
className={`toggle-button ${activeView === "list" ? "active" : ""}`}
className={setElementActive("toggle-button", "list")}
>
<FontAwesomeIcon icon={faList} />
<FontAwesomeIcon
icon={faList}
className={setElementActive("toggle-button-icon", "list")}
/>
<span className={setElementActive("toggle-button-text", "list")}>List</span>
</ToggleButton>
<ToggleButton
title="Complaint Map View"
value="map"
id="map_toggle_id"
className={`toggle-button ${activeView === "map" ? "active" : ""}`}
className={setElementActive("toggle-button", "map")}
>
<FontAwesomeIcon icon={faMap} />
<FontAwesomeIcon
icon={faMap}
className={setElementActive("toggle-button-icon", "map")}
/>
<span className={setElementActive("toggle-button-text", "map")}>Map</span>
</ToggleButton>
</ToggleButtonGroup>
);
Expand Down
18 changes: 16 additions & 2 deletions frontend/src/assets/sass/complaint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1358,21 +1358,35 @@ p {
}

.toggle-button {
background-color: $gray-100 !important;
background-color: white !important;
color: $gray-800 !important;
border-color: $gray-300 !important;
border-radius: 8px;
z-index: 0 !important;
}

.toggle-button.active {
background-color: white !important;
background-color: $gray-100 !important;
color: $gray-800 !important;
border-color: $gray-300 !important;
border-radius: 8px;
z-index: 0 !important;
}

.toggle-button-icon.active {
color: $gray-600 !important;
}

.toggle-button-text {
color: $gray-800 !important;
margin-left: 4px;
}

.toggle-button-text.active {
color: $gray-600 !important;
margin-left: 4px;
}

.comp-filter-search {
margin-left: 16px;
}
Expand Down

0 comments on commit b2a3c63

Please sign in to comment.