Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbett committed Jan 4, 2024
2 parents dbc536c + 8c3d508 commit 246b0de
Show file tree
Hide file tree
Showing 27 changed files with 1,094 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@sharpen-com/kezuri",
"description": "The Sharpen Design System",
"license": "MIT",
"version": "0.5.2",
"version": "0.6.0",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
"es2015": "dist/esm/index.mjs",
Expand Down
42 changes: 42 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export namespace Components {
}
interface SharpenCardHeader {
}
interface SharpenCourseDescription {
/**
* Icon
*/
"icon": string;
}
interface SharpenDashboardCard {
"heading": string;
"imgSrc": string;
Expand Down Expand Up @@ -124,6 +130,12 @@ export namespace Components {
"lowThreshold": number;
"progressVal": number;
}
interface SharpenWizardHeader {
"backHref": string;
"currentStep": number;
"section": string;
"totalSteps": number;
}
}
declare global {
interface HTMLSharpenAlertElement extends Components.SharpenAlert, HTMLStencilElement {
Expand Down Expand Up @@ -162,6 +174,12 @@ declare global {
prototype: HTMLSharpenCardHeaderElement;
new (): HTMLSharpenCardHeaderElement;
};
interface HTMLSharpenCourseDescriptionElement extends Components.SharpenCourseDescription, HTMLStencilElement {
}
var HTMLSharpenCourseDescriptionElement: {
prototype: HTMLSharpenCourseDescriptionElement;
new (): HTMLSharpenCourseDescriptionElement;
};
interface HTMLSharpenDashboardCardElement extends Components.SharpenDashboardCard, HTMLStencilElement {
}
var HTMLSharpenDashboardCardElement: {
Expand Down Expand Up @@ -234,13 +252,20 @@ declare global {
prototype: HTMLSharpenProgressDialElement;
new (): HTMLSharpenProgressDialElement;
};
interface HTMLSharpenWizardHeaderElement extends Components.SharpenWizardHeader, HTMLStencilElement {
}
var HTMLSharpenWizardHeaderElement: {
prototype: HTMLSharpenWizardHeaderElement;
new (): HTMLSharpenWizardHeaderElement;
};
interface HTMLElementTagNameMap {
"sharpen-alert": HTMLSharpenAlertElement;
"sharpen-assessment-header": HTMLSharpenAssessmentHeaderElement;
"sharpen-back": HTMLSharpenBackElement;
"sharpen-card": HTMLSharpenCardElement;
"sharpen-card-content": HTMLSharpenCardContentElement;
"sharpen-card-header": HTMLSharpenCardHeaderElement;
"sharpen-course-description": HTMLSharpenCourseDescriptionElement;
"sharpen-dashboard-card": HTMLSharpenDashboardCardElement;
"sharpen-empty": HTMLSharpenEmptyElement;
"sharpen-footer": HTMLSharpenFooterElement;
Expand All @@ -253,6 +278,7 @@ declare global {
"sharpen-profile-card": HTMLSharpenProfileCardElement;
"sharpen-progress-bar": HTMLSharpenProgressBarElement;
"sharpen-progress-dial": HTMLSharpenProgressDialElement;
"sharpen-wizard-header": HTMLSharpenWizardHeaderElement;
}
}
declare namespace LocalJSX {
Expand Down Expand Up @@ -296,6 +322,12 @@ declare namespace LocalJSX {
}
interface SharpenCardHeader {
}
interface SharpenCourseDescription {
/**
* Icon
*/
"icon"?: string;
}
interface SharpenDashboardCard {
"heading": string;
"imgSrc": string;
Expand Down Expand Up @@ -366,13 +398,20 @@ declare namespace LocalJSX {
"lowThreshold"?: number;
"progressVal"?: number;
}
interface SharpenWizardHeader {
"backHref"?: string;
"currentStep": number;
"section": string;
"totalSteps": number;
}
interface IntrinsicElements {
"sharpen-alert": SharpenAlert;
"sharpen-assessment-header": SharpenAssessmentHeader;
"sharpen-back": SharpenBack;
"sharpen-card": SharpenCard;
"sharpen-card-content": SharpenCardContent;
"sharpen-card-header": SharpenCardHeader;
"sharpen-course-description": SharpenCourseDescription;
"sharpen-dashboard-card": SharpenDashboardCard;
"sharpen-empty": SharpenEmpty;
"sharpen-footer": SharpenFooter;
Expand All @@ -385,6 +424,7 @@ declare namespace LocalJSX {
"sharpen-profile-card": SharpenProfileCard;
"sharpen-progress-bar": SharpenProgressBar;
"sharpen-progress-dial": SharpenProgressDial;
"sharpen-wizard-header": SharpenWizardHeader;
}
}
export { LocalJSX as JSX };
Expand All @@ -397,6 +437,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-course-description": LocalJSX.SharpenCourseDescription & JSXBase.HTMLAttributes<HTMLSharpenCourseDescriptionElement>;
"sharpen-dashboard-card": LocalJSX.SharpenDashboardCard & JSXBase.HTMLAttributes<HTMLSharpenDashboardCardElement>;
"sharpen-empty": LocalJSX.SharpenEmpty & JSXBase.HTMLAttributes<HTMLSharpenEmptyElement>;
"sharpen-footer": LocalJSX.SharpenFooter & JSXBase.HTMLAttributes<HTMLSharpenFooterElement>;
Expand All @@ -409,6 +450,7 @@ declare module "@stencil/core" {
"sharpen-profile-card": LocalJSX.SharpenProfileCard & JSXBase.HTMLAttributes<HTMLSharpenProfileCardElement>;
"sharpen-progress-bar": LocalJSX.SharpenProgressBar & JSXBase.HTMLAttributes<HTMLSharpenProgressBarElement>;
"sharpen-progress-dial": LocalJSX.SharpenProgressDial & JSXBase.HTMLAttributes<HTMLSharpenProgressDialElement>;
"sharpen-wizard-header": LocalJSX.SharpenWizardHeader & JSXBase.HTMLAttributes<HTMLSharpenWizardHeaderElement>;
}
}
}
3 changes: 2 additions & 1 deletion src/components/sharpen-card/sharpen-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ sharpen-card-content {
&[padding="medium"] { padding: var(--spacing-md); }
&[padding="large"] { padding: var(--spacing-lg); }
&[padding="xl"] { padding: var(--spacing-xl); }
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sharpen-course-description sharpen-card {
display: flex;
gap: 1em;
align-items: center;

.sharpen-icon {
color: var(--color-orange);
font-size: var(--font-size-3xl);
}

div { flex: 1; }

li::marker { color: var(--color-orange); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Used within our Onboarding Wizard to display the features of a child's
* personalized Sharpen Reading course. Fill it with list items.
*/
export default {
title: 'Molecules/Course Description',
tags: ['autodocs'],
argTypes: {
icon: {
description: 'Icon to display'
}
},
args: {
icon: 'trophy'
},
render: (args) => `<sharpen-course-description icon="${args.icon}">
<li>Start at Sharpen <strong>Level B1</strong></li>
<li>Easily read texts at a Grade 1 level by <strong>February 28</strong>.</li>
<li>Build increased confidence in reading.</li>
</sharpen-course-description>`
};

export const Example = { };
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Component, Host, Prop, h } from '@stencil/core';

@Component({
tag: 'sharpen-course-description',
styleUrl: 'sharpen-course-description.scss'
})
export class SharpenCourseDescription {

/**
* Icon
*/
@Prop() icon: string;

render() {
return (
<Host>
<sharpen-card padding="medium" border="gray">
<i class="sharpen-icon">{this.icon}</i>
<div>
<ul class="sharpen-list">
<slot></slot>
</ul>
</div>
</sharpen-card>
</Host>
);
}

}
12 changes: 12 additions & 0 deletions src/components/sharpen-wizard-header/sharpen-wizard-header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sharpen-wizard-header {
nav {
display: flex;

.sharpen-icon {
font-size: 14pt;
vertical-align: 4px;
}

h1 { flex: 1; text-align: center; padding-right: 14pt; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { optional } from '../../utils/utils';

/**
* A title and progress bar tailored for our onboarding wizard. (The progress bar is always green.)
*/
export default {
title: 'Organisms/Wizard Header',
tags: ['autodocs'],
argTypes: {
section: {
description: 'The current section.'
},
currentStep: {
description: 'The number of the current step.'
},
totalSteps: {
description: 'The total number of steps in the wizard.'
},
backHref: {
description: 'Optional back button link.'
}
},
render: (args) => `<sharpen-wizard-header section="${args.section}" current-step="${args.currentStep}" total-steps="${args.totalSteps}"${optional('back-href', args.backHref)}></sharpen-wizard-header>`
};

export const WithBackButton = {
args: {
section: 'Learning Profile',
currentStep: 3,
totalSteps: 65,
backHref: 'foo.html'
}
}

/** On the first page of a wizard, we may not want to display a back button. */
export const WithoutBackButton = {
args: {
section: 'Learning Profile',
currentStep: 3,
totalSteps: 65
}
};

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

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

@Prop() section!: string;
@Prop() currentStep!: number;
@Prop() totalSteps!: number;
@Prop() backHref: string;

render() {
const backButton = (this.backHref ? <a href={this.backHref}><i class="sharpen-icon">arrow_back</i></a> : '');

return (
<Host>
<nav class="sharpen-mb-sm">
{backButton}<h1 class="sharpen-heading-sm">{this.section}</h1>
</nav>
<sharpen-progress-bar progress-val={this.currentStep} high-threshold={this.totalSteps} low-threshold={this.totalSteps} elevated-threshold={this.totalSteps}></sharpen-progress-bar>
</Host>
);
}

}
4 changes: 4 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ <h1 class="sharpen-heading-2xl">prototypes.sharpen.com</h1>
</tr>
</thead>
<tbody>
<tr>
<td><a href="prototypes/onboarding-wizard/">Onboarding Wizard</a></td>
<td>Dec 2023</td>
</tr>
<tr>
<td><a href="prototypes/responsive-nav/">Responsive Primary Navigation</a></td>
<td>Dec 2023</td>
Expand Down
53 changes: 53 additions & 0 deletions src/pages/wizard.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Canvas, Meta } from '@storybook/blocks';
import * as WizardStories from './wizard.stories';

<Meta of={WizardStories} />

# Onboarding Wizard

## Radio Question

* Note that, in this example, the wizard header is not configured with a
`back-href` attribute since it is the first question and thus no back button
should be displayed.
* Radio questions, unless specified otherwise, should be built to save the
user's answer and advance to the next question automatically when an option
is clicked.

<Canvas of={WizardStories.RadioQuestion} sourceState="hidden" />

## Checkbox Question

* Because checkbox questions allow the user to select 0, 1, or more options,
we display a submit button at the bottom and only advance to the next
question when the user clicks it.

<Canvas of={WizardStories.CheckboxQuestion} sourceState="hidden" />

## Email Question

* Even though the Wizard flow has a distinct style, it is still built on top of
Kezuri; therefore, we can use text input fields and show field-level
validations as usual.
* Because the we intend to keep the user focused on one goal during this wizard,
we try to avoid including links that might take the user elsewhere. We must,
however, provide access to the Terms and Privacy Policy. These links should
open in a new browser tab (i.e. `target="_blank"`), so that the wizard flow
does not get fully interrupted.

<Canvas of={WizardStories.EmailQuestion} sourceState="hidden" />

## Estimate

* Apply `sharpen-background--green` to the `body` tag so that the entire page
appears with the green background color. (Due to the limitations of
Storybook, the background class in the story below has been applied to the
container element.)
* This example uses chart.js to render a simple visualization of how the child
might progress over three months.

<Canvas of={WizardStories.Estimate} sourceState="hidden" />

## Personalized Course (i.e. Shopping Cart)

<Canvas of={WizardStories.PersonalizedCourse} sourceState="hidden" />
Loading

0 comments on commit 246b0de

Please sign in to comment.