Skip to content

Commit

Permalink
fix: simplified implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulthink committed Dec 7, 2022
1 parent 3fe14db commit 82538fa
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/lib/icons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export type IconProvider = (
iconId: string
) => HTMLElement | URL | string;
export type IconProvider = (iconId: string) => HTMLElement | URL | string;

export enum MaterialIconsStyle {
FILLED = 'filled',
Expand Down Expand Up @@ -65,7 +63,10 @@ export function MaterialIcons(
}

export function PlaceIcons(): IconProvider {
return iconId => createURL(iconId);
return iconId =>
new URL(
`https://maps.gstatic.com/mapfiles/place_api/icons/v2/${iconId}_pinlet.svg`
);
}

/**
Expand All @@ -82,12 +83,6 @@ function createSpan(className: string, content: string): HTMLElement {
return el;
}

function createURL(content: string) {
return new URL(
`https://maps.gstatic.com/mapfiles/place_api/icons/v2/${content}_pinlet.svg`
);
}

/**
* Checks existing google fonts link tags for the specified material-icons
* font-family.
Expand Down

0 comments on commit 82538fa

Please sign in to comment.