{"size": 1198, "ext": "js", "max_stars_repo_path": "src/utils.js", "max_stars_repo_name": "subhh/HOS-Metadata-Visualisation", "max_stars_repo_stars_event_min_datetime": "2022-02-04T09:22:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-04T09:22:45.000Z", "max_issues_repo_path": "src/utils.js", "max_issues_repo_name": "subhh/HOS-Metadata-Visualisation", "max_issues_repo_issues_event_min_datetime": "2019-11-25T10:26:47.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-02T14:01:57.000Z", "max_forks_repo_path": "src/utils.js", "max_forks_repo_name": "subhh/HOS-Metadata-Visualisation", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 21.7818181818, "max_line_length": 80, "alphanum_fraction": 0.5726210351}
import { formatLocale } from 'd3'

const locale = formatLocale({
  decimal: ',',
  thousands: '.',
  grouping: [3],
  currency: [' €', ''],
})

export const format = value => locale.format(',')(value)

export const fill = ({ theme, fill }) => ({
  fill: theme.colors[fill] || fill,
})

export const centerSVG = ({ theme, fill }) => ({
  position: 'relative',
  svg: {
    position: 'absolute',
    left: '50%',
    top: '50%',
    transform: 'translate(-50%, -50%)',
  },
})

export const scaledWidth = ({ theme, width }) => ({
  width: `${theme.space[width] || width}px`,
})

export const scaledHeight = ({ theme, height }) => ({
  height: `${theme.space[height] || height}px`,
})

export const shadow = ({ theme, type = 'normal' }) => ({
  boxShadow: theme.shadows[type],
})

export const outline = ({ theme }) => ({
  borderRadius: '4px',
  border: `2px solid ${theme.colors.blueMediumDark}`,
})

export const invert = ({ theme }) => ({
  background: theme.colors.blueMediumDark,
  svg: {
    fill: 'white',
  },
})

export const translateXY = ({ x = 0, y = 0 }) => ({
  transform: `translate(${x}px,${y}px)`,
})

export const displayDebug = ({ debug }) => (debug ? { display: 'initial' } : {})
