Skip to content

Commit

Permalink
feat(homebutton): allow custom actions when pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Feb 4, 2025
1 parent 9071d18 commit d9c94bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/utah-design-system/src/components/HomeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ export const HomeButton = ({
view,
position,
initialExtent,
actions,
}: {
view: __esri.MapView;
position?: __esri.UIAddComponent['position'];
initialExtent?: __esri.Extent;
actions?: Function[];
}) => {
const goHome = useDefaultExtent(view, initialExtent);
const uiPosition = useViewUiPosition(view, position ?? 'top-left');
Expand All @@ -24,7 +26,10 @@ export const HomeButton = ({
variant="icon"
className="size-full stroke-[4] p-0 transition-colors duration-150 ease-in-out will-change-transform group-hover:bg-[#f3f3f3] focus:min-h-0 focus:outline-offset-[-2px]"
aria-label="Default extent"
onPress={() => goHome()}
onPress={() => {
goHome();
actions?.forEach((action) => action());
}}
>
<HomeIcon
className="size-5 stroke-[1.5] text-[#6e6e6e] transition-colors duration-150 ease-in-out will-change-transform group-hover:text-[#151515]"
Expand Down

0 comments on commit d9c94bd

Please sign in to comment.