Skip to content

Commit

Permalink
🐛 fix: remove double check for defaults / respect unit settings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhellmann committed Aug 18, 2022
1 parent 69ad700 commit 39d5634
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailwindcss-fluid-type",
"version": "v2.0.0-alpha.2",
"version": "v2.0.0-alpha.3",
"description": "Bring fluid type to tailwindcss",
"main": "src/index.js",
"license": "MIT",
Expand Down
16 changes: 8 additions & 8 deletions src/utils/calcModularScale.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const defaults = require("../config/defaults");

module.exports = (value, data) => {
if (data.settingsAreNumbers && data.settings && defaults.settings) {
const sFtMin = data.settings?.fontSizeMin || defaults.settings?.fontSizeMin
const sFtMax = data.settings?.fontSizeMax || defaults.settings?.fontSizeMax
const sFtRMin = data.settings?.ratioMin || defaults.settings?.ratioMin
const sFtRMax = data.settings?.ratioMax || defaults.settings?.ratioMax
const sFtSMin = data.settings?.screenMin || defaults.settings?.screenMin
const sFtSMax = data.settings?.screenMax || defaults.settings?.screenMax
const unit = data.settings?.unit || defaults.settings?.unit
if (data.settingsAreNumbers && data.settings) {
const sFtMin = data.settings?.fontSizeMin
const sFtMax = data.settings?.fontSizeMax
const sFtRMin = data.settings?.ratioMin
const sFtRMax = data.settings?.ratioMax
const sFtSMin = data.settings?.screenMin
const sFtSMax = data.settings?.screenMax
const unit = data.unit
const sFtUnit = typeof unit === 'string' ? unit : 'rem';
const ftMin = sFtMin * Math.pow(sFtRMin, value);
const ftMax = sFtMax * Math.pow(sFtRMax, value);
Expand Down
1 change: 1 addition & 0 deletions src/utils/createData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = (options, data) => {

// Add prefix
data.prefix = options.settings?.prefix || defaults.settings?.prefix || ''
data.unit = options.settings?.unit || defaults.settings?.unit || 'rem'

// Add number check
data.settingsAreNumbers = Object
Expand Down

0 comments on commit 39d5634

Please sign in to comment.