Skip to content

Commit 95c0f38

Browse files
authored
Merge pull request #115 from w3c/feature/profile-page-template
Feature/profile page template
2 parents 22b0a5d + 53a6189 commit 95c0f38

File tree

17 files changed

+140
-92
lines changed

17 files changed

+140
-92
lines changed

assets-src/js/main/disclosure-widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let disclosureWidget = function () {
2525

2626
});
2727

28-
if (document.body.classList.contains('group')) {
28+
if (document.body.classList.contains('profile')) {
2929

3030
// Media query event handler
3131
let mq = window.matchMedia('(min-width: 64em)');

assets-src/styles/core.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
@import "sass/80-templates/post";
122122
@import "sass/80-templates/landing";
123123
@import "sass/80-templates/listing";
124-
@import "sass/80-templates/group";
124+
@import "sass/80-templates/profile";
125125
@import "sass/80-templates/technical-reports";
126126

127127

assets-src/styles/sass/80-templates/_group.scss renamed to assets-src/styles/sass/80-templates/_profile.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*------------------------------------*\
2-
#Group detail
2+
#Profile template
33
\*------------------------------------*/
44

5-
.group .content {
5+
.profile .content {
66
max-width: rem(752);
77
}
88

99
@supports(grid-column-gap: 8%) {
10-
.group .content {
10+
.profile .content {
1111
max-width: none;
1212

1313
@include mq($bp-tab-large) {
@@ -21,26 +21,26 @@
2121
}
2222
}
2323

24-
.group .content h1 {
24+
.profile .content h1 {
2525
@include mq($bp-tab-large) {
2626
grid-area: title;
2727
}
2828
}
2929

30-
.group .content #group-nav {
30+
.profile .content #profile-nav {
3131
@include mq($bp-tab-large) {
3232
grid-area: nav;
3333
}
3434
}
3535

36-
.group .content .details {
36+
.profile .content .details {
3737
@include mq($bp-tab-large) {
3838
grid-area: details;
3939
}
4040
}
4141
}
4242

43-
.group .group-nav__inner {
43+
.profile .profile-nav__inner {
4444
margin-bottom: rem(33);
4545

4646
@include mq($bp-tab-large) {
@@ -55,7 +55,7 @@
5555
}
5656
}
5757

58-
.group [data-toggle="true"] {
58+
.profile [data-toggle="true"] {
5959
@include mq($bp-tab-large) {
6060
display: none;
6161
}
@@ -65,7 +65,7 @@
6565
}
6666
}
6767

68-
#group-nav a {
68+
#profile-nav a {
6969
display: inline-block;
7070
padding-bottom: rem(10);
7171
padding-top: rem(10);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<button type="button" class="button button--ghost with-icon with-icon--after" style="display:none;" data-toggle="true">Toggle content <svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 320 512" class="icon" focusable="false" aria-hidden="true" width="1em" height="1em"><path class="angle-down" d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"/><path class="angle-up" d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"/></svg></button>

design-system-templates/example-pages/group-details.html.twig

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% extends 'base.html.twig' %}
2+
3+
{% block title %}Profile template{% endblock %}
4+
{% block meta_description %}Profile template from the W3C design system{% endblock %}
5+
6+
{% block body_class %}class="profile"{% endblock %}
7+
8+
{% block breadcrumbs %}
9+
{% include 'components/breadcrumbs.html.twig' %}
10+
{% endblock %}
11+
12+
{% block content %}
13+
<div class="content">
14+
15+
<h1>Profile template</h1>
16+
17+
{% include 'components/disclosure-button.html.twig' %}
18+
19+
<nav id="profile-nav" aria-label="Details">
20+
<div class="profile-nav__inner">
21+
<ul class="clean-list" role="list">
22+
<li><a href="#" aria-current="true">Overview</a></li>
23+
<li><a href="path/to/page">Edit profile</a></li>
24+
<li><a href="path/to/page">Calendar</a></li>
25+
</ul>
26+
</div>
27+
</nav>
28+
29+
<div class="details">
30+
31+
{% include 'components/text.html.twig' %}
32+
33+
</div>
34+
35+
</div>
36+
{% endblock %}
37+
38+
{% block crosslinks %}
39+
{% endblock %}
40+
41+
{% block scripts %}
42+
{% endblock %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Disclosure button
2+
3+
When included on a page, provided that JavaScript is available, the element directly following the button in the DOM is hidden from users. Pressing the button then toggles the display of that element. See it in action on the [profile template](../templates/profile.md).
4+
5+
<example title="Disclosure button" src="components/disclosure-button.html.twig" />
6+
7+
## Considerations
8+
9+
Note the use of the inline style `display: none;` and the data attribute `data-toggle="true"` on the button. This data attribute is targeted by JavaScript for adding the hide/show functionality. In the absence of JavaScript the button remains hidden to users and the element directly following the button is expanded by default.
10+
11+
When used on the [profile template](../templates/profile.md), a CSS media query hides the button when the viewport size is at least 1024px wide, and the element directly following the button (in this case navigation) is fully displayed in a sidebar.

docs/templates/group-details.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/templates/profile.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Profile template
2+
3+
An example of the profile template. This example does not include:
4+
5+
- the complete [global navigation](../components/navigation.md)
6+
- the complete list of site links for the [footer](../components/footer.md).
7+
8+
<example title="Profile template" src="example-pages/profile.html.twig" standalone />
9+
10+
## Considerations
11+
12+
Note the `.profile` class applied to `<body>`.
13+
14+
Note the inclusion of the [disclosure button](../components/disclosure-button.md) on this template. This is optional.

public/dist/assets/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ let disclosureWidget = function () {
466466
btn.style = "";
467467
btn.setAttribute('aria-expanded', 'false');
468468
});
469-
if (document.body.classList.contains('group')) {
469+
if (document.body.classList.contains('profile')) {
470470
// Media query event handler
471471
let mq = window.matchMedia('(min-width: 64em)');
472472
mq.addListener(WidthChange);

0 commit comments

Comments
 (0)