-
Notifications
You must be signed in to change notification settings - Fork 222
feat: Added a range #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Added a range #173
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <demo-page-title> | ||
| <div header>Rating</div> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Range |
||
| <div sub-header> | ||
| <p>A rating indicates user interest in content</p> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A range allows you to select a range of values? |
||
| </div> | ||
| </demo-page-title> | ||
| <demo-page-content> | ||
| <sui-message class="info" [isDismissable]="false"> | ||
| <div class="header">Important Note</div> | ||
| <p> | ||
| The range is a port of <a href="https://github.com/tyleryasaka/semantic-ui-range">Semantic-UI-Range</a>, | ||
| an external module for Semantic UI. If you'd like to use the range in your app, you must include the module's | ||
| CSS alongside Semantic UI's. | ||
| </p> | ||
| <div class="ui segment"> | ||
| <demo-codeblock language="markup" [src]="cssInclude"></demo-codeblock> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This repo has the code in it... I wonder if there is a way of easily pulling out the theming files? |
||
| </div> | ||
| </sui-message> | ||
| <h2 class="ui dividing header">Examples</h2> | ||
| <demo-example [code]="exampleStandardTemplate"> | ||
| <div info> | ||
| <h4 class="ui header">Range</h4> | ||
| <p>A basic range</p> | ||
| </div> | ||
| <example-range-standard result></example-range-standard> | ||
| </demo-example> | ||
| <demo-example [code]="exampleMinMaxTemplate"> | ||
| <div info> | ||
| <h4 class="ui header">Range</h4> | ||
| <p>Range with min max</p> | ||
| </div> | ||
| <example-range-min-max result></example-range-min-max> | ||
| </demo-example> | ||
| <demo-example [code]="exampleStepTemplate"> | ||
| <div info> | ||
| <h4 class="ui header">Range</h4> | ||
| <p>Range that skips 5 values with each step</p> | ||
| </div> | ||
| <example-range-step result></example-range-step> | ||
| </demo-example> | ||
| <h2 id="api" class="ui dividing header">API</h2> | ||
| <demo-api [api]="api"></demo-api> | ||
| </demo-page-content> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| import { Component } from "@angular/core"; | ||
| import { ApiDefinition } from "../../../components/api/api.component"; | ||
|
|
||
| const exampleStandardTemplate = ` | ||
| <div class="ui form"> | ||
| <div class="field"> | ||
| <label>Range</label> | ||
| <sui-range [(value)]="value" [isReadonly]="readonly"></sui-range> | ||
| </div> | ||
| <div class="field"> | ||
| <label>Value</label> | ||
| <div class="ui action input"> | ||
| <input type="number" [(ngModel)]="value"> | ||
|
|
||
| <button class="ui green icon button" (click)="value = value + 10"> | ||
| <i class="plus icon"></i> | ||
| </button> | ||
| <button class="ui red icon button" (click)="value = value - 10"> | ||
| <i class="minus icon"></i> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| <div class="field"> | ||
| <sui-checkbox [(ngModel)]="readonly">Read Only?</sui-checkbox> | ||
| </div> | ||
| </div> | ||
| `; | ||
|
|
||
| const exampleMinMaxTemplate = ` | ||
| <div class="ui form"> | ||
| <div class="field"> | ||
| <label>Range with max value of 42 and min value of 11</label> | ||
| <sui-range [(value)]="value" [max]="42" [min]="11"></sui-range> | ||
| </div> | ||
| <div class="field"> | ||
| <label>Value</label> | ||
| <div class="ui action input"> | ||
| <input type="number" [(ngModel)]="value"> | ||
|
|
||
| <button class="ui green icon button" (click)="value = value + 10"> | ||
| <i class="plus icon"></i> | ||
| </button> | ||
| <button class="ui red icon button" (click)="value = value - 10"> | ||
| <i class="minus icon"></i> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| `; | ||
|
|
||
| const exampleStepTemplate = ` | ||
| <div class="ui form"> | ||
| <div class="field"> | ||
| <label>Range that skips 5 values each step</label> | ||
| <sui-range [(value)]="value" [step]="5"></sui-range> | ||
| </div> | ||
| <div class="field"> | ||
| <label>Value</label> | ||
| <div class="ui action input"> | ||
| <input type="number" [(ngModel)]="value"> | ||
|
|
||
| <button class="ui green icon button" (click)="value = value + 10"> | ||
| <i class="plus icon"></i> | ||
| </button> | ||
| <button class="ui red icon button" (click)="value = value - 10"> | ||
| <i class="minus icon"></i> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| `; | ||
|
|
||
| @Component({ | ||
| selector: "demo-page-range", | ||
| templateUrl: "./range.page.html" | ||
| }) | ||
| export class RangePage { | ||
| public api:ApiDefinition = [ | ||
| { | ||
| selector: "<sui-range>", | ||
| properties: [ | ||
| { | ||
| name: "min", | ||
| type: "number", | ||
| description: "The minimum value of the range.", | ||
| defaultValue: "0" | ||
| }, | ||
| { | ||
| name: "max", | ||
| type: "number", | ||
| description: "The maximum value of the range.", | ||
| defaultValue: "100" | ||
| }, | ||
| { | ||
| name: "step", | ||
| type: "number", | ||
| description: "The amount each step skips in value, for step 2 the value will skip like so: 0, 2, 4...", | ||
| defaultValue: "100" | ||
| }, | ||
| { | ||
| name: "isReadonly", | ||
| type: "boolean", | ||
| description: "Sets whether or not the value is read-only. ", | ||
| defaultValue: "false" | ||
| } | ||
| ], | ||
| events: [ | ||
| { | ||
| name: "valueChange", | ||
| type: "number", | ||
| description: "Fires whenever the value value is changed." | ||
| } | ||
| ] | ||
| } | ||
| ]; | ||
| public exampleStandardTemplate:string = exampleStandardTemplate; | ||
| public exampleMinMaxTemplate:string = exampleMinMaxTemplate; | ||
| public exampleStepTemplate:string = exampleStepTemplate; | ||
| public cssInclude:string = `<link rel="stylesheet" href="https://unpkg.com/[email protected]/range.css">`; | ||
| } | ||
|
|
||
| @Component({ | ||
| selector: "example-range-standard", | ||
| template: exampleStandardTemplate | ||
| }) | ||
| export class RangeExampleStandard { | ||
| public value:number = 3; | ||
| public readonly:boolean; | ||
| } | ||
|
|
||
| @Component({ | ||
| selector: "example-range-min-max", | ||
| template: exampleMinMaxTemplate | ||
| }) | ||
| export class RangeExampleMinMax { | ||
| public value:number = 3; | ||
| public readonly:boolean; | ||
| } | ||
|
|
||
| @Component({ | ||
| selector: "example-range-step", | ||
| template: exampleStepTemplate | ||
| }) | ||
| export class RangeExampleStep { | ||
| public value:number = 5; | ||
| public readonly:boolean; | ||
| } | ||
|
|
||
| export const RangePageComponents = [RangePage, RangeExampleStandard, RangeExampleMinMax, RangeExampleStep]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css"> | ||
| <!-- Calendar Module CSS --> | ||
| <link rel="stylesheet" href="https://unpkg.com/semantic-ui-calendar/dist/calendar.min.css"> | ||
| <!-- Range Module CSS --> | ||
| <link rel="stylesheet" href="https://unpkg.com/[email protected]/range.css"> | ||
|
|
||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/prism.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/components/prism-bash.min.js"></script> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave the import structure as it was