Skip to content

Commit

Permalink
New components:
Browse files Browse the repository at this point in the history
- Choice Grid
- Simple Navigation
- Story Page
- Story Header
- Waiting Bar

Plus prototype updates.
  • Loading branch information
jabbett committed Mar 22, 2024
1 parent bdfc400 commit 53bddfa
Show file tree
Hide file tree
Showing 41 changed files with 1,355 additions and 307 deletions.
75 changes: 75 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export namespace Components {
}
interface SharpenCardHeader {
}
interface SharpenChoiceGrid {
}
interface SharpenCourseDescription {
/**
* Icon
Expand Down Expand Up @@ -136,6 +138,19 @@ export namespace Components {
}
interface SharpenSimpleMetric {
}
interface SharpenSimpleNavigation {
"background": string;
"brandHref": string;
}
interface SharpenStoryHeader {
}
interface SharpenStoryPage {
"backgroundSrc": string;
"characterSrc": string;
"contentMode": string;
}
interface SharpenWaitingBar {
}
interface SharpenWizardHeader {
"backHref": string;
"currentStep": number;
Expand Down Expand Up @@ -180,6 +195,12 @@ declare global {
prototype: HTMLSharpenCardHeaderElement;
new (): HTMLSharpenCardHeaderElement;
};
interface HTMLSharpenChoiceGridElement extends Components.SharpenChoiceGrid, HTMLStencilElement {
}
var HTMLSharpenChoiceGridElement: {
prototype: HTMLSharpenChoiceGridElement;
new (): HTMLSharpenChoiceGridElement;
};
interface HTMLSharpenCourseDescriptionElement extends Components.SharpenCourseDescription, HTMLStencilElement {
}
var HTMLSharpenCourseDescriptionElement: {
Expand Down Expand Up @@ -270,6 +291,30 @@ declare global {
prototype: HTMLSharpenSimpleMetricElement;
new (): HTMLSharpenSimpleMetricElement;
};
interface HTMLSharpenSimpleNavigationElement extends Components.SharpenSimpleNavigation, HTMLStencilElement {
}
var HTMLSharpenSimpleNavigationElement: {
prototype: HTMLSharpenSimpleNavigationElement;
new (): HTMLSharpenSimpleNavigationElement;
};
interface HTMLSharpenStoryHeaderElement extends Components.SharpenStoryHeader, HTMLStencilElement {
}
var HTMLSharpenStoryHeaderElement: {
prototype: HTMLSharpenStoryHeaderElement;
new (): HTMLSharpenStoryHeaderElement;
};
interface HTMLSharpenStoryPageElement extends Components.SharpenStoryPage, HTMLStencilElement {
}
var HTMLSharpenStoryPageElement: {
prototype: HTMLSharpenStoryPageElement;
new (): HTMLSharpenStoryPageElement;
};
interface HTMLSharpenWaitingBarElement extends Components.SharpenWaitingBar, HTMLStencilElement {
}
var HTMLSharpenWaitingBarElement: {
prototype: HTMLSharpenWaitingBarElement;
new (): HTMLSharpenWaitingBarElement;
};
interface HTMLSharpenWizardHeaderElement extends Components.SharpenWizardHeader, HTMLStencilElement {
}
var HTMLSharpenWizardHeaderElement: {
Expand All @@ -283,6 +328,7 @@ declare global {
"sharpen-card": HTMLSharpenCardElement;
"sharpen-card-content": HTMLSharpenCardContentElement;
"sharpen-card-header": HTMLSharpenCardHeaderElement;
"sharpen-choice-grid": HTMLSharpenChoiceGridElement;
"sharpen-course-description": HTMLSharpenCourseDescriptionElement;
"sharpen-dashboard-card": HTMLSharpenDashboardCardElement;
"sharpen-empty": HTMLSharpenEmptyElement;
Expand All @@ -298,6 +344,10 @@ declare global {
"sharpen-progress-circle": HTMLSharpenProgressCircleElement;
"sharpen-progress-dial": HTMLSharpenProgressDialElement;
"sharpen-simple-metric": HTMLSharpenSimpleMetricElement;
"sharpen-simple-navigation": HTMLSharpenSimpleNavigationElement;
"sharpen-story-header": HTMLSharpenStoryHeaderElement;
"sharpen-story-page": HTMLSharpenStoryPageElement;
"sharpen-waiting-bar": HTMLSharpenWaitingBarElement;
"sharpen-wizard-header": HTMLSharpenWizardHeaderElement;
}
}
Expand Down Expand Up @@ -342,6 +392,8 @@ declare namespace LocalJSX {
}
interface SharpenCardHeader {
}
interface SharpenChoiceGrid {
}
interface SharpenCourseDescription {
/**
* Icon
Expand Down Expand Up @@ -424,6 +476,19 @@ declare namespace LocalJSX {
}
interface SharpenSimpleMetric {
}
interface SharpenSimpleNavigation {
"background"?: string;
"brandHref"?: string;
}
interface SharpenStoryHeader {
}
interface SharpenStoryPage {
"backgroundSrc"?: string;
"characterSrc"?: string;
"contentMode"?: string;
}
interface SharpenWaitingBar {
}
interface SharpenWizardHeader {
"backHref"?: string;
"currentStep": number;
Expand All @@ -437,6 +502,7 @@ declare namespace LocalJSX {
"sharpen-card": SharpenCard;
"sharpen-card-content": SharpenCardContent;
"sharpen-card-header": SharpenCardHeader;
"sharpen-choice-grid": SharpenChoiceGrid;
"sharpen-course-description": SharpenCourseDescription;
"sharpen-dashboard-card": SharpenDashboardCard;
"sharpen-empty": SharpenEmpty;
Expand All @@ -452,6 +518,10 @@ declare namespace LocalJSX {
"sharpen-progress-circle": SharpenProgressCircle;
"sharpen-progress-dial": SharpenProgressDial;
"sharpen-simple-metric": SharpenSimpleMetric;
"sharpen-simple-navigation": SharpenSimpleNavigation;
"sharpen-story-header": SharpenStoryHeader;
"sharpen-story-page": SharpenStoryPage;
"sharpen-waiting-bar": SharpenWaitingBar;
"sharpen-wizard-header": SharpenWizardHeader;
}
}
Expand All @@ -465,6 +535,7 @@ declare module "@stencil/core" {
"sharpen-card": LocalJSX.SharpenCard & JSXBase.HTMLAttributes<HTMLSharpenCardElement>;
"sharpen-card-content": LocalJSX.SharpenCardContent & JSXBase.HTMLAttributes<HTMLSharpenCardContentElement>;
"sharpen-card-header": LocalJSX.SharpenCardHeader & JSXBase.HTMLAttributes<HTMLSharpenCardHeaderElement>;
"sharpen-choice-grid": LocalJSX.SharpenChoiceGrid & JSXBase.HTMLAttributes<HTMLSharpenChoiceGridElement>;
"sharpen-course-description": LocalJSX.SharpenCourseDescription & JSXBase.HTMLAttributes<HTMLSharpenCourseDescriptionElement>;
"sharpen-dashboard-card": LocalJSX.SharpenDashboardCard & JSXBase.HTMLAttributes<HTMLSharpenDashboardCardElement>;
"sharpen-empty": LocalJSX.SharpenEmpty & JSXBase.HTMLAttributes<HTMLSharpenEmptyElement>;
Expand All @@ -480,6 +551,10 @@ declare module "@stencil/core" {
"sharpen-progress-circle": LocalJSX.SharpenProgressCircle & JSXBase.HTMLAttributes<HTMLSharpenProgressCircleElement>;
"sharpen-progress-dial": LocalJSX.SharpenProgressDial & JSXBase.HTMLAttributes<HTMLSharpenProgressDialElement>;
"sharpen-simple-metric": LocalJSX.SharpenSimpleMetric & JSXBase.HTMLAttributes<HTMLSharpenSimpleMetricElement>;
"sharpen-simple-navigation": LocalJSX.SharpenSimpleNavigation & JSXBase.HTMLAttributes<HTMLSharpenSimpleNavigationElement>;
"sharpen-story-header": LocalJSX.SharpenStoryHeader & JSXBase.HTMLAttributes<HTMLSharpenStoryHeaderElement>;
"sharpen-story-page": LocalJSX.SharpenStoryPage & JSXBase.HTMLAttributes<HTMLSharpenStoryPageElement>;
"sharpen-waiting-bar": LocalJSX.SharpenWaitingBar & JSXBase.HTMLAttributes<HTMLSharpenWaitingBarElement>;
"sharpen-wizard-header": LocalJSX.SharpenWizardHeader & JSXBase.HTMLAttributes<HTMLSharpenWizardHeaderElement>;
}
}
Expand Down
29 changes: 29 additions & 0 deletions src/components/sharpen-choice-grid/sharpen-choice-grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
sharpen-choice-grid {
display: grid;
gap: 1em;
grid-template-columns: repeat(2, 1fr);
font-weight: bold;
font-size: 18pt;
text-align: center;

&[layout="column"] {
display: flex;
flex-direction: column;
text-align: left;
font-weight: normal;
font-size: 24pt;
}

a {
--animate-duration: 1.5s;
text-decoration: none;
}

a img {
max-width: 100%;
}

a.highlight sharpen-card, a:hover sharpen-card {
background-color: var(--color-sky);
}
}
18 changes: 18 additions & 0 deletions src/components/sharpen-choice-grid/sharpen-choice-grid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Component, Host, h } from '@stencil/core';

@Component({
tag: 'sharpen-choice-grid',
styleUrl: 'sharpen-choice-grid.scss',
})
export class SharpenChoiceGrid {

render() {

return (
<Host>
<slot></slot>
</Host>
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sharpen-simple-navigation {
.navbar {
height: 4.5rem;
background-color: var(--color-mint);
color: var(--color-evergreen);
display: flex;
align-items: center;
justify-content: space-around;
--mask:
linear-gradient(to top,#0000 10px,#000 0),
radial-gradient(10px,#000 98%,#0000) bottom/18.5px 20px;
-webkit-mask: var(--mask);
mask: var(--mask);
}

.navbar .brand img { height: 31px; }

&[background="sunrise"] .navbar {
background-color: var(--color-sunrise);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Component, Prop, Host, getAssetPath, h } from '@stencil/core';

@Component({
tag: 'sharpen-simple-navigation',
styleUrl: 'sharpen-simple-navigation.scss',
})
export class SharpenSimpleNavigation {

@Prop() background: string;
@Prop() brandHref: string;

render() {

// Logo mark without the text
const markSrc = getAssetPath('assets/images/brand/sharpen_mark_evergreen.png');

return (
<Host>
<div class="navbar container-fluid">
<a class="brand" href={this.brandHref}><img src={markSrc} /></a>
</div>
</Host>
);
}

}
8 changes: 8 additions & 0 deletions src/components/sharpen-story-header/sharpen-story-header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sharpen-story-header {
display: block;
text-align: center;
margin: 0 0 var(--spacing-lg) 0;

img { height: 12rem; }
.sharpen-icon { font-size: 64pt; color: var(--color-red); }
}
18 changes: 18 additions & 0 deletions src/components/sharpen-story-header/sharpen-story-header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Component, Host, h } from '@stencil/core';

@Component({
tag: 'sharpen-story-header',
styleUrl: 'sharpen-story-header.scss',
})
export class SharpenStoryHeader {

render() {

return (
<Host>
<slot></slot>
</Host>
);
}

}
27 changes: 27 additions & 0 deletions src/components/sharpen-story-page/sharpen-story-page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
sharpen-story-page {
display: block;
padding: 0 0 1em 0;
box-shadow: rgba(0,0,0,0.5) 0 1em 3em;

.content {
padding: var(--spacing-lg);
color: var(--color-pine);
}

&[content-mode="sentence"] .content { font-size: 28pt; }
&[content-mode="paragraph"] .content { font-size: 14pt; line-height: 1.5; }
&[content-mode="paragraph"] .story-footer { height: 12rem; }

.story-footer {
height: 18rem;
background-size: 100%;
background-repeat: no-repeat;
background-position: bottom;

img {
height: 12rem;
margin-top: 5rem;
}
}

}
49 changes: 49 additions & 0 deletions src/components/sharpen-story-page/sharpen-story-page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Component, Prop, Host, h } from '@stencil/core';

@Component({
tag: 'sharpen-story-page',
styleUrl: 'sharpen-story-page.scss',
})
export class SharpenStoryPage {

@Prop() contentMode: string;
@Prop() backgroundSrc: string;
@Prop() characterSrc: string;

render() {

return (
<Host>
<div class="content">
<slot></slot>
</div>
<div class={this.getFooterClasses()} style={this.getBackgroundStyle()}>
{this.getCharacterImg()}
</div>
</Host>
);
}

getFooterClasses() {
return {
"story-footer": true,
"with-background": this.backgroundSrc && this.backgroundSrc.length > 0,
"with-character": this.characterSrc && this.characterSrc.length > 0,
}
}

getBackgroundStyle() {
if (this.backgroundSrc) {
return { "background-image": 'url(' + this.backgroundSrc + ')' };
}
}

getCharacterImg() {
if (this.characterSrc) {
return (
<img src={this.characterSrc} />
)
}
}

}
27 changes: 27 additions & 0 deletions src/components/sharpen-waiting-bar/sharpen-waiting-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
sharpen-waiting-bar {
display: block;
padding: 6px;
background: white;
border-radius: 6px;
border: 1px solid #ccc;

.bar {
height: 18px;
border-radius: 4px;
transition: 0.4s linear;
transition-property: width, background-color;
background-color: var(--color-mint);
width: 100%;
background-image: linear-gradient(
45deg, var(--color-pine) 25%,
transparent 25%, transparent 50%,
var(--color-pine) 50%, var(--color-pine) 75%,
transparent 75%, transparent);
animation: progressAnimationStrike 12s;
}

@keyframes progressAnimationStrike {
from { width: 0 }
to { width: 100% }
}
}
Loading

0 comments on commit 53bddfa

Please sign in to comment.