From c9056e00158260d214359846d302820228e1b6f9 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 12 Sep 2018 23:36:05 +0200 Subject: [PATCH] shutterspeed fraction fix --- gatsby-node.js | 6 +++--- package.json | 2 +- src/components/atoms/Exif.module.scss | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index ca24f560..887bec45 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -4,7 +4,7 @@ const yaml = require('js-yaml') const { createFilePath } = require('gatsby-source-filesystem') const { paginate } = require('gatsby-awesome-pagination') const fastExif = require('fast-exif') -const { Fraction } = require('fractional') +const Fraction = require('fraction.js') const meta = yaml.load(fs.readFileSync('./content/meta.yml', 'utf8')) const { itemsPerPage } = meta @@ -71,13 +71,13 @@ const generateExif = (exifData, createNodeField, node) => { ExposureBiasValue } = exifData.exif - const { numerator, denominator } = new Fraction(ExposureTime) + const { n, d } = new Fraction(ExposureTime) const exposureShortened = parseFloat(ExposureBiasValue.toFixed(2)) const model = `${Model}` const iso = `ISO ${ISO}` const fstop = `ƒ ${FNumber}` - const shutterspeed = `${numerator}/${denominator}s` + const shutterspeed = `${n}/${d}s` const focalLength = `${FocalLength}mm` let exposure diff --git a/package.json b/package.json index 946b406a..d783707a 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ ], "dependencies": { "fast-exif": "^1.0.1", - "fractional": "^1.0.0", + "fraction.js": "^4.0.9", "gatsby": "^2.0.0-rc.21", "gatsby-awesome-pagination": "^0.1.1", "gatsby-image": "^2.0.0-rc.2", diff --git a/src/components/atoms/Exif.module.scss b/src/components/atoms/Exif.module.scss index 14255300..d463b4af 100644 --- a/src/components/atoms/Exif.module.scss +++ b/src/components/atoms/Exif.module.scss @@ -4,7 +4,7 @@ .exif { font-size: $font-size-mini; color: $brand-grey-light; - margin-top: -($spacer * 1.5); + margin-top: -($spacer * 1.25); margin-bottom: $spacer * 2; display: flex; flex-wrap: wrap;