/
byu-user-info.html
190 lines (167 loc) · 7.26 KB
/
byu-user-info.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!--
~ @license
~ Copyright 2016 Brigham Young University
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="load-components.js"></script>
<script async src="lib/html-imports/html-imports.min.js"></script>
<link rel="import" href="lib/iron-demo-helpers/demo-snippet.html">
<style>
html {
height: 100%;
}
body {
display: flex;
flex-direction: column;
height: 100%;
}
/* wrap the page in this for an easy sticky footer and max-width */
.page-content {
flex: 1;
margin: 0 auto;
max-width: 1200px;
width: 100%;
padding: 16px;
box-sizing: border-box;
}
</style>
</head>
<body>
<byu-header>
<span slot="site-title">Components Demo Site</span>
<byu-menu slot="nav" collapsed>
<a href="index.html">Home</a>
<a href="byu-header.html">Header</a>
<a href="byu-menu.html">Menu</a>
<a href="byu-search.html">Search</a>
<a class="active" href="byu-user-info.html">User Info</a>
<a href="byu-footer.html">Footer</a>
</byu-menu>
<byu-search slot="search"></byu-search>
</byu-header>
<div class="page-content">
<h1>User Info Demo</h1>
<h2>Simple Setup</h2>
<demo-snippet>
<template>
<byu-header>
<span slot="site-title">Components Demo Site</span>
<byu-user-info slot="user">
<a slot="login" href="#login">Sign In</a>
<a slot="logout" href="#logout">Sign Out</a>
</byu-user-info>
</byu-header>
</template>
</demo-snippet>
<h2>Logged In User</h2>
<p>If your website provides anything to the slot 'user-name' then it will know that the user is logged in. If this is not provided, it will believe no one is logged in.</p>
<demo-snippet>
<template>
<byu-header>
<span slot="site-title">Components Demo Site</span>
<byu-user-info slot="user">
<a slot="login" href="#login">Sign In</a>
<a slot="logout" href="#logout">Sign Out</a>
<span slot="user-name">UserFirstName</span>
</byu-user-info>
</byu-header>
</template>
</demo-snippet>
<h2>As Part of Header with Search</h2>
<demo-snippet>
<template>
<byu-header>
<span slot="site-title">Components Demo Site</span>
<byu-search slot="search" action="https://www.google.com/#q=$1" method="get" placeholder="Search"></byu-search>
<byu-user-info slot="user" login-url="#login">
<a slot="login" href="#login">Sign In</a>
<a slot="logout" href="#logout">Sign Out</a>
</byu-user-info>
<byu-menu slot="nav" collapsed>
<a class="active" href="javascript: void 0">Link 1</a>
<a href="javascript: void 0">Link 2</a>
<a href="javascript: void 0">Link 3</a>
<a href="javascript: void 0">Link 4</a>
<a href="javascript: void 0">Link 5</a>
<a href="javascript: void 0">Link 6</a>
</byu-menu>
</byu-header>
</template>
</demo-snippet>
<h2>As Part of Header with Search (Logged In)</h2>
<demo-snippet>
<template>
<byu-header>
<span slot="site-title">Components Demo Site</span>
<byu-search slot="search" action="https://www.google.com/#q=$1" method="get" placeholder="Search"></byu-search>
<byu-user-info slot="user" login-url="#login">
<a slot="login" href="#login">Sign In</a>
<a slot="logout" href="#logout">Sign Out</a>
<span slot="user-name">UserFirstName</span>
</byu-user-info>
<byu-menu slot="nav" collapsed>
<a class="active" href="javascript: void 0">Link 1</a>
<a href="javascript: void 0">Link 2</a>
<a href="javascript: void 0">Link 3</a>
<a href="javascript: void 0">Link 4</a>
<a href="javascript: void 0">Link 5</a>
<a href="javascript: void 0">Link 6</a>
</byu-menu>
</byu-header>
</template>
</demo-snippet>
<h2>Overriding CMS Styles</h2>
<p>
Many Content Management Systems will add extra divs and spans around your login/logout links. Unfortunately, Web Components
only allow you to style directly in the Shadow DOM. To fix this, you'll need some custom CSS. The exact CSS needed
will vary depending on your CMS, but this should give you the idea.
</p>
<demo-snippet>
<template>
<style>
.my-custom-login-class a {
color: white;
font-family: 'HCo Ringside Narrow SSm', Arial, sans-serif;
cursor: pointer;
}
.my-custom-login-class a:hover {
color: white;
text-decoration: none;
}
</style>
<byu-header>
<span slot="site-title">Components Demo Site</span>
<byu-user-info slot="user">
<span slot="login" class="my-custom-login-class">
<div class="someCMSClass">
<a class="someOtherCMSClassAndAttributes">Sign In</a>
</div>
</span>
<a slot="logout" href="#logout">Sign Out</a>
</byu-user-info>
</byu-header>
</template>
</demo-snippet>
</div>
<footer>
<byu-footer></byu-footer>
</footer>
</body>
</html>