DEV Community

JWP
JWP

Posted on

4

An Angular Responsive Component

Using the HTML 5 Grid, we are able to create responsive web sites easily by including it in our new ResponsiveComponent.

Responsive Component CSS

Shown below is the start of our ResponsiveComponent CSS markup. It starts with a grid and has styles for a Header, Aside, Main and Footer component.

The ResponsiveComponent is only for applying CSS styling for everything contained within it.

Alt Text

Next, we assign styles using only tagnames to the grid areas. Angular has allowed us to create the header, footer and main components.

Alt Text

The ResponsiveComponent, MainComponent, and FooterComponent only contain this markup at the HTML layer. This means they are only applying styles for each section.

Alt Text

All of our components (responsive, main, footer and header) look like this at TS layer. Notice the shortened selector name.

Alt Text

Create Responsive pages

Finally we compose a new website or website page with this HTML, assembling the parts.

Alt Text

Responsive Web Pages All Day

Alt Text

Comments

This component does away with the need for any of the immensely popular CSS Frameworks. It 100% responsive and can be used/reused for an entire website. Other page layouts are simple to do, just change the grid areas templates.

JWP2019

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay