Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor triangle to use calc() #616

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

roginfarrer
Copy link

triangle() currently expects height and width values that are a string value with a unit (e.g. '12px') or a number (12). It throws an error otherwise.

This prevents the use of CSS custom variables. However, if we change from using JS arithmetic to CSS calc(), we can support CSS variables, in addition to number of unit values, without having to do any unit stripping in strings.

@roginfarrer roginfarrer requested a review from bhough as a code owner May 19, 2022 17:00
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

lint-staged --debug
yarn lint-staged --debug
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can omit this. But I thought it odd that the repo requires lint-staged be installed globally when it's a dependency of the project.

@@ -267,7 +267,7 @@ describe('triangle', () => {
)
})

it('should throw an error when height or width is not a unit based value.', () => {
it.skip('should throw an error when height or width is not a unit based value.', () => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q for the reviewer, do we want to keep this check, but then also explicitly check for a value starting with var(--?

@codecov
Copy link

codecov bot commented Feb 3, 2023

Codecov Report

Merging #616 (a40a1de) into main (275e646) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #616   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           89        89           
  Lines          860       858    -2     
  Branches       323       320    -3     
=========================================
- Hits           860       858    -2     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/mixins/triangle.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants