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

Feature/td media #22

Merged
merged 6 commits into from
Jul 19, 2016
Merged

Feature/td media #22

merged 6 commits into from
Jul 19, 2016

Conversation

emoralesb05
Copy link
Contributor

@emoralesb05 emoralesb05 commented Jul 19, 2016

Description

Added a basic query media support inside core module. (might relocate in the future)
#20

What's included?

tdMediaService

This service is designed to provide basic media query evaluation for responsive applications.
It has pre-programmed support for media queries that match the layout breakpoints.
image
Usage in Typescript:

constructor(private _mediaService: TdMediaService, private _ngZone: NgZone) {
  }
  checkScreen(): void {
    this._ngZone.run(() => {
      this.isSmallScreen = this._mediaService.query('md'); // or '(min-width: 960px) and (max-width: 1279px)'
    });
  }
  watchScreen(): void {
    this._querySubscription = this._mediaService.registerQuery(demoObj.query).subscribe((matches: boolean) => {
      this._ngZone.run(() => {
        this.isSmallScreen = matches;
      });
    });
  }

tdMediaService methods:
image

tdMediaToggleDirective

Added tdMediaToggleDirective directive to leverage tdMediaService and toggle attributes, classes or/and styles from an element.

Usage in HTML:

<div tdMediaToggle="sm" [mediaClasses]="['classOne', 'classTwo'']"
  [mediaAttributes]="{title: 'tooltip'}" [mediaStyles]="{color: 'red'}">
  ...
</div>

Properties:
image

Test Steps

  • Go to components docs and see Media link.
  • Use demo and see documentation.
  • Try to use directive and service anywhere in app.
  • ✌️
Screenshots or link to CodePen/Plunker/JSfiddle

media-check

Ed Morales and others added 3 commits July 19, 2016 10:43
@kyleledbetter kyleledbetter merged commit 341f56e into develop Jul 19, 2016
@kyleledbetter kyleledbetter mentioned this pull request Jul 19, 2016
4 tasks
@emoralesb05 emoralesb05 deleted the feature/td-media branch July 19, 2016 18:26
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.

3 participants