// Takes a font's name and transforms it into a Google Fonts URL. The `text`
// param loads specific letters to cut down on request size; `display=swap`
// allows a placeholder font to be shown before the real one is loaded.
export function formatUrl(font, weight) {
  const fontName = font.split(" ").join("+")
  const letters = font.replaceAll("+", "").replaceAll(" ", "")
  return `https://fonts.googleapis.com/css2?text=${letters}&family=${fontName}:wght@${weight}&display=swap`
}
