Skip to content

Design service for helping build responsive components #45

@hansl

Description

@hansl

We should have something that works both in headless rendering and browsers.

The solution should be something along those lines (pseudo code):

@Injectable()
export class MdLayoutService {
  onLayoutChange: EventEmitter<MdLayoutEnum> = new EventEmitter<MdLayoutEnum>();
  get currentLayout(): MdLayoutEnum {
    return this.layout_;
  }

  constructor(private layout_: MdLayoutEnum) {
    if (!headless) {  // <-- Tricky part
      window.matchMedia('...').addListener((mql) => this.onLayoutChange.emit(...));
    }
  }
};

You can then provide an MdLayoutEnum constant in headless browsing (or if you want to fix it in the browser or unit tests).

TODO:

  • Design Doc.

Metadata

Metadata

Assignees

Labels

designThis issue needs design work before implementingfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions