-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(responsive): add lyShow & lyHide
- Loading branch information
Showing
18 changed files
with
235 additions
and
67 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
File renamed without changes.
13 changes: 8 additions & 5 deletions
13
src/app/components/responsive-demo/responsive-demo-01/responsive-demo-01.component.html
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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<!-- <p *lyResponsive="'(min-width: 320px)'"> | ||
responsive-demo-01 works! | ||
</p> --> | ||
<p>Handset : {{ responsive.observe('Handset') | async | json }}</p> | ||
<div *ngFor="let item of queries" [lyShow]="item.key"> | ||
<p> | ||
<strong color="warn">{{ item.key }}: </strong>{{ item.mediaQuery }} | ||
</p> | ||
</div> | ||
<!-- ···deprecated··· --> | ||
<!-- <p>Handset : {{ responsive.observe('Handset') | async | json }}</p> | ||
<p>Tablet : {{ responsive.observe('Tablet') | async | json }}</p> | ||
<p>Web : {{ responsive.observe('Web') | async | json }}</p> | ||
<p>HandsetPortrait : {{ responsive.observe('HandsetPortrait') | async | json }}</p> | ||
<p>TabletPortrait : {{ responsive.observe('TabletPortrait') | async | json }}</p> | ||
<p>WebPortrait : {{ responsive.observe('WebPortrait') | async | json }}</p> | ||
<p>HandsetLandscape: {{ responsive.observe('HandsetLandscape') | async | json }}</p> | ||
<p>TabletLandscape : {{ responsive.observe('TabletLandscape') | async | json }}</p> | ||
<p>WebLandscape : {{ responsive.observe('WebLandscape') | async | json }}</p> | ||
<p>WebLandscape : {{ responsive.observe('WebLandscape') | async | json }}</p> --> |
30 changes: 20 additions & 10 deletions
30
src/app/components/responsive-demo/responsive-demo-01/responsive-demo-01.component.ts
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
2 changes: 2 additions & 0 deletions
2
src/app/components/responsive-demo/responsive-demo-01/responsive-demo-01.module.ts
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 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,12 @@ | ||
export enum InvertMediaQuery { | ||
No, | ||
Yes | ||
} | ||
|
||
export function transformMediaQuery(media: string, invertMediaQuery: InvertMediaQuery = InvertMediaQuery.No): string | string[] { | ||
if (media && invertMediaQuery === InvertMediaQuery.Yes) { | ||
const newVal = media.split(',').map(_ => `not ${_}`); | ||
return newVal; | ||
} | ||
return media; | ||
} |
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 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 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 |
---|---|---|
@@ -1,16 +1,38 @@ | ||
export const MediaQueries = { | ||
Handset: '(max-width: 599px) and (orientation: portrait), ' + | ||
'(max-width: 959px) and (orientation: landscape)', | ||
Tablet: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait), ' + | ||
'(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)', | ||
Web: '(min-width: 840px) and (orientation: portrait), ' + | ||
'(min-width: 1280px) and (orientation: landscape)', | ||
export const Breakpoints = { | ||
XSmall: 'screen and (max-width: 599px)', | ||
Small: 'screen and (min-width: 600px) and (max-width: 959px)', | ||
Medium: 'screen and (min-width: 960px) and (max-width: 1279px)', | ||
Large: 'screen and (min-width: 1280px) and (max-width: 1919px)', | ||
XLarge: 'screen and (min-width: 1920px)', | ||
|
||
Handset: 'screen and (max-width: 599px) and (orientation: portrait), ' + | ||
'screen and (max-width: 959px) and (orientation: landscape)', | ||
Tablet: 'screen and (min-width: 600px) and (max-width: 839px) and (orientation: portrait), ' + | ||
'screen and (min-width: 960px) and (max-width: 1279px) and (orientation: landscape)', | ||
Web: 'screen and (min-width: 840px) and (orientation: portrait), ' + | ||
'screen and (min-width: 1280px) and (orientation: landscape)', | ||
|
||
HandsetPortrait: '(max-width: 599px) and (orientation: portrait)', | ||
TabletPortrait: '(min-width: 600px) and (max-width: 839px) and (orientation: portrait)', | ||
WebPortrait: '(min-width: 840px) and (orientation: portrait)', | ||
HandsetPortrait: 'screen and (max-width: 599px) and (orientation: portrait)', | ||
TabletPortrait: 'screen and (min-width: 600px) and (max-width: 839px) and (orientation: portrait)', | ||
WebPortrait: 'screen and (min-width: 840px) and (orientation: portrait)', | ||
|
||
HandsetLandscape: '(max-width: 959px) and (orientation: landscape)', | ||
TabletLandscape: '(min-width: 960px) and (max-width: 1279px) and (orientation: landscape)', | ||
WebLandscape: '(min-width: 1280px) and (orientation: landscape)', | ||
HandsetLandscape: 'screen and (max-width: 959px) and (orientation: landscape)', | ||
TabletLandscape: 'screen and (min-width: 960px) and (max-width: 1279px) and (orientation: landscape)', | ||
WebLandscape: 'screen and (min-width: 1280px) and (orientation: landscape)', | ||
}; | ||
|
||
export const MediaQueries = { | ||
'xs': 'screen and (max-width: 599px)', | ||
'sm': 'screen and (min-width: 600px) and (max-width: 959px)', | ||
'md': 'screen and (min-width: 960px) and (max-width: 1279px)', | ||
'lg': 'screen and (min-width: 1280px) and (max-width: 1919px)', | ||
'xl': 'screen and (min-width: 1920px) and (max-width: 5000px)', | ||
'lt-sm': 'screen and (max-width: 599px)', | ||
'lt-md': 'screen and (max-width: 959px)', | ||
'lt-lg': 'screen and (max-width: 1279px)', | ||
'lt-xl': 'screen and (max-width: 1919px)', | ||
'gt-xs': 'screen and (min-width: 600px)', | ||
'gt-sm': 'screen and (min-width: 960px)', | ||
'gt-md': 'screen and (min-width: 1280px)', | ||
'gt-lg': 'screen and (min-width: 1920px)' | ||
}; |
Oops, something went wrong.