mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
fix(): update to Stencil One 🎉🎊
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
import { Component, ComponentInterface, Prop } from '@stencil/core';
|
||||
import { Component, ComponentInterface, Prop, h } from '@stencil/core';
|
||||
|
||||
import { Color, Mode } from '../../interface';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { Color } from '../../interface';
|
||||
import { createColorClasses } from '../../utils/theme';
|
||||
|
||||
/**
|
||||
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
||||
*/
|
||||
@Component({
|
||||
tag: 'ion-badge',
|
||||
styleUrls: {
|
||||
@ -19,16 +23,13 @@ export class Badge implements ComponentInterface {
|
||||
*/
|
||||
@Prop() color?: Color;
|
||||
|
||||
/**
|
||||
* The mode determines which platform styles to use.
|
||||
*/
|
||||
@Prop() mode!: Mode;
|
||||
|
||||
hostData() {
|
||||
const mode = getIonMode(this);
|
||||
|
||||
return {
|
||||
class: {
|
||||
...createColorClasses(this.color),
|
||||
[`${this.mode}`]: true
|
||||
[`${mode}`]: true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -38,11 +38,10 @@ Badges are inline block elements that usually appear near another element. Typic
|
||||
|
||||
```tsx
|
||||
import React from 'react';
|
||||
import { IonBadge, IonItem, IonLabel, IonContent } from '@ionic/react';
|
||||
|
||||
import { IonBadge, IonItem, IonLabel } from '@ionic/react';
|
||||
|
||||
const Example: React.SFC<{}> = () => (
|
||||
<>
|
||||
export const BadgeExample: React.FunctionComponent = () => (
|
||||
<IonContent>
|
||||
{/*-- Default --*/}
|
||||
<IonBadge>99</IonBadge>
|
||||
|
||||
@ -63,10 +62,8 @@ const Example: React.SFC<{}> = () => (
|
||||
<IonLabel>My Item</IonLabel>
|
||||
<IonBadge slot="end">22</IonBadge>
|
||||
</IonItem>
|
||||
</>
|
||||
</IonContent>
|
||||
);
|
||||
|
||||
export default Example;
|
||||
```
|
||||
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script src="../../../../../dist/ionic.js"></script>
|
||||
</head>
|
||||
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script src="../../../../../dist/ionic.js"></script>
|
||||
</head>
|
||||
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<link href="../../../../../css/core.css" rel="stylesheet">
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script src="../../../../../dist/ionic.js"></script>
|
||||
</head>
|
||||
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head>
|
||||
|
||||
<body class="ion-padding">
|
||||
<h1>Default</h1>
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
```tsx
|
||||
import React from 'react';
|
||||
import { IonBadge, IonItem, IonLabel, IonContent } from '@ionic/react';
|
||||
|
||||
import { IonBadge, IonItem, IonLabel } from '@ionic/react';
|
||||
|
||||
const Example: React.SFC<{}> = () => (
|
||||
<>
|
||||
export const BadgeExample: React.FunctionComponent = () => (
|
||||
<IonContent>
|
||||
{/*-- Default --*/}
|
||||
<IonBadge>99</IonBadge>
|
||||
|
||||
@ -25,8 +24,6 @@ const Example: React.SFC<{}> = () => (
|
||||
<IonLabel>My Item</IonLabel>
|
||||
<IonBadge slot="end">22</IonBadge>
|
||||
</IonItem>
|
||||
</>
|
||||
</IonContent>
|
||||
);
|
||||
|
||||
export default Example;
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user