Skip to content

Polymer-based web components and shared styles for applying D2L typography

License

Notifications You must be signed in to change notification settings

jstefaniuk-d2l/d2l-typography-ui

 
 

Repository files navigation

Looking for SASS-based d2l-typography? It's over here.

d2l-typography

Bower version Build status

A set of Polymer-based web components and shared styles for applying D2L typography.

For further information on this and other D2L UI components, see the docs at ui.valence.d2l.com.

Installation

d2l-typography can be installed from Bower:

bower install d2l-typography

Usage

Include the webcomponents.js "lite" polyfill (for browsers who don't natively support web components), import d2l-typography.html, and include the d2l-typography shared style:

<head>
	<script src="https://s.brightspace.com/lib/webcomponentsjs/0.7.21/webcomponents-lite.min.js"></script>
	<link rel="import" href="../d2l-typography/d2l-typography.html">
	<style is="custom-style" include="d2l-typography"></style>
</head>

Body

The d2l-typography class can be used to set base font properties, typically applied to the <body> element.

<body class="d2l-typography">
	...
</body>

The default font family, color and line/character spacing will look like this:

screenshot of paragraph text

Headings

There are four separate classes for the available heading styles. These would typically be applied to the <h1>, <h2>, <h3> and <h4> HTML elements, though it's not a requirement.

<h1 class="d2l-heading-1">...</h1>
<h2 class="d2l-heading-2">...</h2>
<h3 class="d2l-heading-3">...</h3>
<h4 class="d2l-heading-4">...</h4>

screenshot of headings

Help Text

The custom d2l-help-text element can be used to apply styling to help text.

<d2l-help-text>...</d2l-help-text>

Note About Font Size

Normally within Brightspace, the user-configured base font size will automatically be present, and requires no additional work to opt-in. However, if your application exists outside of Brightspace, you should set your desired font size on the <html> element. The default recommended size is 20px:

html {
    font-size: 20px;
}

Usage in Production

In production, it's recommended to use a build tool like Vulcanize to combine all your web components into a single import file. More from the Polymer Docs: Optimize for Production...

Coding styles

See the Best Practices & Style Guide for information on naming conventions, plus information about the EditorConfig rules used in this repo.

About

Polymer-based web components and shared styles for applying D2L typography

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 93.0%
  • JavaScript 7.0%