This repository has been archived by the owner on Sep 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4f8f3f
commit f6442e7
Showing
15 changed files
with
487 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
{ | ||
"version": 3, | ||
"name": "Badge", | ||
"data": [ | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "class", | ||
"kind": "const", | ||
"static": false, | ||
"readonly": true, | ||
"type": { | ||
"kind": "type", | ||
"text": "string", | ||
"type": "string" | ||
}, | ||
"localName": "klass" | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "value", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "string", | ||
"type": "string" | ||
}, | ||
"defaultValue": "" | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "active", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "boolean", | ||
"type": "boolean" | ||
}, | ||
"defaultValue": true | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "bordered", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "boolean", | ||
"type": "boolean" | ||
}, | ||
"defaultValue": false | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "dot", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "boolean", | ||
"type": "boolean" | ||
}, | ||
"defaultValue": false | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "tile", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "boolean", | ||
"type": "boolean" | ||
}, | ||
"defaultValue": false | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "bottom", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "boolean", | ||
"type": "boolean" | ||
}, | ||
"defaultValue": false | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "left", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "boolean", | ||
"type": "boolean" | ||
}, | ||
"defaultValue": false | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "label", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "string", | ||
"type": "string" | ||
}, | ||
"defaultValue": "Badge" | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "transition", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "any", | ||
"type": "any" | ||
} | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "offsetX", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "number", | ||
"type": "number" | ||
}, | ||
"defaultValue": 6 | ||
}, | ||
{ | ||
"visibility": "public", | ||
"description": null, | ||
"keywords": [], | ||
"name": "offsetY", | ||
"kind": "let", | ||
"static": false, | ||
"readonly": false, | ||
"type": { | ||
"kind": "type", | ||
"text": "number", | ||
"type": "number" | ||
}, | ||
"defaultValue": 6 | ||
} | ||
], | ||
"computed": [], | ||
"methods": [], | ||
"components": [], | ||
"description": null, | ||
"keywords": [], | ||
"events": [], | ||
"slots": [ | ||
{ | ||
"name": "default", | ||
"description": null, | ||
"visibility": "public", | ||
"parameters": [] | ||
}, | ||
{ | ||
"name": "badge", | ||
"description": null, | ||
"visibility": "public", | ||
"parameters": [] | ||
} | ||
], | ||
"refs": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script> | ||
import { Icon, Badge } from 'svelte-materialify/src'; | ||
</script> | ||
|
||
<div class="d-flex pt-4 pb-4 justify-space-around"> | ||
<Badge class="success-color" value={2}> | ||
<Icon class="mdi mdi-home" /> | ||
</Badge> | ||
<Badge class="primary-color" dot left> | ||
<Icon class="mdi mdi-account" /> | ||
</Badge> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default as basic } from './basic.svelte'; | ||
export { default as notifications } from './notifications.svelte'; | ||
export { default as offset } from './offset.svelte'; |
25 changes: 25 additions & 0 deletions
25
packages/docs/src/examples/components/badges/notifications.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script> | ||
import { Icon, Badge, Button } from 'svelte-materialify/src'; | ||
let value = 1; | ||
</script> | ||
|
||
<div class="d-flex pt-4 pb-4 justify-space-around align-center"> | ||
<Button | ||
class="success-color" | ||
on:click={() => { | ||
value += 1; | ||
}}> | ||
Notify | ||
</Button> | ||
<Button | ||
class="error-color" | ||
on:click={() => { | ||
value = 0; | ||
}}> | ||
Clear Notifications | ||
</Button> | ||
<Badge class="primary-color" active={value !== 0} {value}> | ||
<Icon class="mdi mdi-home" /> | ||
</Badge> | ||
</div> |
18 changes: 18 additions & 0 deletions
18
packages/docs/src/examples/components/badges/offset.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script> | ||
import { Button, Badge, Avatar, Icon } from 'svelte-materialify/src'; | ||
</script> | ||
|
||
<div class="d-flex pt-4 pb-4 justify-space-around"> | ||
<Badge class="error-color" bordered offsetX={10} offsetY={10}> | ||
<Button class="error-color">Button</Button> | ||
<span slot="badge"> | ||
<Icon class="mdi mdi-lock" /> | ||
</span> | ||
</Badge> | ||
<Badge class="primary-color" dot bottom offsetX={10} offsetY={10}> | ||
<Avatar><img src="//picsum.photos/50" alt="profile" /></Avatar> | ||
</Badge> | ||
<Badge class="primary-color" bordered value={2} offsetX={16} offsetY={16}> | ||
<Avatar><img src="//picsum.photos/50" alt="profile" /></Avatar> | ||
</Badge> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Badges | ||
related: | ||
- Icons: /components/icons/ | ||
- Alerts: /components/alerts/ | ||
--- | ||
|
||
<script context="module"> | ||
export async function preload() { | ||
let sources = await this.fetch('examples/components/badges.json'); | ||
sources = await sources.json(); | ||
return { sources }; | ||
} | ||
</script> | ||
|
||
<script> | ||
import { API, Example, setExamples } from '@shared'; | ||
import * as Examples from '@examples/components/badges'; | ||
import { Badge as doc } from 'svelte-materialify-api'; | ||
export let sources; | ||
setExamples([sources, Examples]); | ||
</script> | ||
|
||
# Badges | ||
|
||
The `Badge` component superscripts or subscripts an avatar-like icon or text onto content to highlight information to a user or to just draw attention to a specific element. Content within the badge usually contains numbers or icons. | ||
|
||
## API | ||
|
||
<API {doc} /> | ||
|
||
## Examples | ||
|
||
Below is a collection of simple to complex examples. | ||
|
||
### Basic | ||
|
||
This is how to use basic badges. | ||
<Example name="basic" /> | ||
|
||
### Dynamic Notifications | ||
|
||
You can incorporate badges with dynamic content to make things such as a notification system. | ||
<Example name="notifications" /> | ||
|
||
### Offset | ||
|
||
The `Badge` component is flexible and can be used in a variety of use-cases over numerous elements. Options to tweak the location are also available through the `offsetX` and `offsetY` props. | ||
<Example name="offset" /> |
Oops, something went wrong.
f6442e7
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.
Successfully deployed to the following URLs: