-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
706 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,46 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [2.51.22](https://github.com/gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-27) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-doc | ||
|
||
|
||
|
||
|
||
|
||
## [2.51.21](https://github.com/gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-27) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-doc | ||
|
||
|
||
|
||
|
||
|
||
## [2.51.20](https://github.com/gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-23) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-doc | ||
|
||
|
||
|
||
|
||
|
||
## [2.51.19](https://github.com/gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-22) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-doc | ||
|
||
|
||
|
||
|
||
|
||
## [2.51.18](https://github.com/gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-22) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-doc | ||
|
||
|
||
|
||
|
||
|
||
## [2.51.17](https://github.com/gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-21) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-doc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [1.1.0](https://github.com/Gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-22) | ||
|
||
|
||
### Features | ||
|
||
* **helpers:** add typescript in media and hide files ([bab4964](https://github.com/Gympass/yoga/commit/bab49646af97021cf258046fe7bebdc5c6a26fe6)) | ||
* **helpers:** create types ([ceeeae4](https://github.com/Gympass/yoga/commit/ceeeae43172d52900bafa1b0b8c38bb3d33aebf1)) | ||
|
||
|
||
|
||
|
||
|
||
## [1.0.5](https://github.com/Gympass/yoga/compare/@gympass/[email protected]...@gympass/[email protected]) (2024-05-15) | ||
|
||
**Note:** Version bump only for package @gympass/yoga-helpers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import tokens, { BreakpointsKey } from '@gympass/yoga-tokens'; | ||
|
||
import { css } from 'styled-components'; | ||
|
||
import hide from './hide'; | ||
import { Matcher, Media, Width } from './types'; | ||
|
||
const { breakpoints, BREAKPOINTS_KEYS } = tokens; | ||
|
||
const availableBreakpoints = BREAKPOINTS_KEYS as BreakpointsKey[]; | ||
|
||
const media: Media = { not: {} } as Media; | ||
|
||
export const not = (isNot?: boolean) => (isNot ? 'not all and ' : ''); | ||
|
||
const getRange = (width: Width, range: 'min' | 'max') => { | ||
try { | ||
if (Array.isArray(width)) { | ||
const [min, max] = width; | ||
|
||
const { | ||
[min]: { width: minBreakpoint }, | ||
[max]: { width: maxBreakpoint } | ||
} = breakpoints; | ||
|
||
return `(min-width: ${minBreakpoint}px) and (max-width: ${maxBreakpoint}px)`; | ||
} | ||
|
||
return `(${range}-width: ${breakpoints[width].width}px)`; | ||
} catch { | ||
const msg = `Make sure you've entered the right breakpoints. | ||
Your input: ${Array.isArray(width) ? width.join(', ') : width} | ||
Available breakpoints: ${availableBreakpoints.join(', ')}`; | ||
|
||
throw new Error(msg); | ||
} | ||
}; | ||
|
||
export const matcher: Matcher = | ||
(width: Width, isNot = false, range: 'min' | 'max' = 'min') => | ||
(...style) => { | ||
return css` | ||
@media ${not(isNot)}${getRange(width, range)} { | ||
${css(...style)} | ||
} | ||
`; | ||
}; | ||
|
||
availableBreakpoints.forEach((breakpoint) => { | ||
media[breakpoint] = matcher(breakpoint); | ||
media.not[breakpoint] = matcher(breakpoint, true); | ||
}); | ||
|
||
media.max = (width: Width) => matcher(width, false, 'max'); | ||
media.not.max = (width: Width) => matcher(width, true, 'max'); | ||
|
||
media.between = (min: BreakpointsKey, max: BreakpointsKey) => | ||
matcher([min, max], false, 'max'); | ||
media.not.between = (min: BreakpointsKey, max: BreakpointsKey) => | ||
matcher([min, max], true, 'max'); | ||
|
||
media.hide = hide(); | ||
media.not.hide = hide(true); | ||
|
||
export default media; |
Oops, something went wrong.