瀏覽代碼

Fix: Bring back styles on Switch components when checked

Fixed bug introduced by replacing native input with @grafana/ui/Input component.

Switch's styling relies on native input checked attribute used in adjacent sibling selector. Because React based Input is wrapped in div, there was no chance for styling to work
Dominik Prokop 6 年之前
父節點
當前提交
6b2c81bcf2
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      packages/grafana-ui/src/components/Switch/Switch.tsx

+ 1 - 2
packages/grafana-ui/src/components/Switch/Switch.tsx

@@ -1,6 +1,5 @@
 import React, { PureComponent } from 'react';
 import uniqueId from 'lodash/uniqueId';
-import { Input } from '@grafana/ui';
 
 export interface Props {
   label: string;
@@ -39,7 +38,7 @@ export class Switch extends PureComponent<Props, State> {
         <label htmlFor={labelId} className={`gf-form gf-form-switch-container ${className || ''}`}>
           {label && <div className={labelClassName}>{label}</div>}
           <div className={switchClassName}>
-            <Input id={labelId} type="checkbox" checked={checked} onChange={this.internalOnChange} />
+            <input id={labelId} type="checkbox" checked={checked} onChange={this.internalOnChange} />
             <span className="gf-form-switch__slider" />
           </div>
         </label>