Commit 45dfa204 by Torkel Ödegaard Committed by GitHub

Buttons: Center text in buttons (#23789)

* Buttons: Center buttons

* Updated size of transformation button

* removed snapshot
parent 78a6d39e
......@@ -91,9 +91,9 @@ export interface GrafanaThemeCommons {
};
};
height: {
sm: string;
md: string;
lg: string;
sm: number;
md: number;
lg: number;
};
panelPadding: number;
panelHeaderHeight: number;
......
......@@ -87,7 +87,9 @@ export const getButtonStyles = stylesFactory((props: StyleProps) => {
font-family: ${theme.typography.fontFamily.sansSerif};
font-size: ${fontSize};
padding: ${padding};
height: ${height};
height: ${height}px;
// Deduct border from line-height for perfect vertical centering on windows and linux
line-height: ${height - 2}px;
vertical-align: middle;
cursor: pointer;
border: 1px solid ${borderColor};
......
......@@ -71,8 +71,9 @@ const getRadioButtonStyles = stylesFactory((theme: GrafanaTheme, size: RadioButt
display: inline-block;
position: relative;
font-size: ${fontSize};
height: ${height};
line-height: ${height};
height: ${height}px;
// Deduct border from line-height for perfect vertical centering on windows and linux
line-height: ${height - 2}px;
color: ${textColor};
padding: 0 ${horizontalPadding};
margin-left: -1px;
......
import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';
import { UnthemedTimeRangePicker } from './TimeRangePicker';
import { dateTime, TimeRange } from '@grafana/data';
import dark from '../../themes/dark';
......@@ -15,7 +15,7 @@ const value: TimeRange = {
describe('TimePicker', () => {
it('renders buttons correctly', () => {
const wrapper = shallow(
const wrapper = mount(
<UnthemedTimeRangePicker
onChange={value => {}}
value={value}
......@@ -25,22 +25,6 @@ describe('TimePicker', () => {
theme={dark}
/>
);
expect(wrapper).toMatchSnapshot();
});
it('renders content correctly after beeing open', () => {
const wrapper = shallow(
<UnthemedTimeRangePicker
onChange={value => {}}
value={value}
onMoveBackward={() => {}}
onMoveForward={() => {}}
onZoom={() => {}}
theme={dark}
/>
);
wrapper.find('button[aria-label="TimePicker Open Button"]').simulate('click', new Event('click'));
expect(wrapper).toMatchSnapshot();
expect(wrapper.exists('.navbar-button')).toBe(true);
});
});
......@@ -115,9 +115,9 @@ const theme: GrafanaThemeCommons = {
},
},
height: {
sm: '24px',
md: '32px',
lg: '48px',
sm: 24,
md: 32,
lg: 48,
},
panelPadding: 8,
panelHeaderHeight: 28,
......
......@@ -55,6 +55,7 @@ export class TransformationsEditor extends React.PureComponent<Props> {
variant="secondary"
label="Add transformation"
options={availableTransformers}
size="lg"
onChange={this.onTransformationAdd}
isFullWidth={false}
/>
......
......@@ -54,8 +54,8 @@
>
<icon name="'history'" size="'xs'" style="margin-bottom: 2px"></icon>&nbsp;&nbsp;Restore
</a>
<a class="btn btn-outline-disabled btn-small" ng-show="revision.version === ctrl.dashboard.version">
<icon name="'check'" size="'xs'" style="margin-bottom: 2px"></icon>&nbsp;&nbsp;Latest
<a class="label label-tag" ng-show="revision.version === ctrl.dashboard.version">
Latest
</a>
</td>
</tr>
......
......@@ -92,9 +92,9 @@ $grid-gutter-width: 30px !default;
// Component heights
// -------------------------
$height-sm: 24px;
$height-md: 32px;
$height-lg: 48px;
$height-sm: 24;
$height-md: 32;
$height-lg: 48;
// Typography
// -------------------------
......
......@@ -17,7 +17,7 @@
vertical-align: middle;
cursor: pointer;
border: none;
height: $height-md;
height: $height-md + px;
@include button-size($btn-padding-y, $space-md, $font-size-base, $border-radius-sm);
......@@ -70,7 +70,7 @@
.btn-large {
@include button-size($btn-padding-y-lg, $space-lg, $font-size-lg, $border-radius-sm);
font-weight: normal;
height: $height-lg;
height: $height-lg + px;
.gicon {
//font-size: 31px;
......@@ -81,13 +81,13 @@
.btn-small {
@include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
height: $height-sm;
height: $height-sm + px;
}
// Deprecated, only used by old plugins
.btn-mini {
@include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
height: $height-sm;
height: #{height-sm}px;
}
.btn-link {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment