chore: make control panel sub sections look better (#24736)

This commit is contained in:
Maxime Beauchemin
2023-07-20 16:33:50 -07:00
committed by GitHub
parent 9b6ed315f8
commit 22a0fe555c
25 changed files with 145 additions and 55 deletions

View File

@@ -0,0 +1,26 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { styled } from '@superset-ui/core';
export const ControlSubSectionHeader = styled.div`
font-weight: ${({ theme }) => theme.typography.weights.bold};
font-size: ${({ theme }) => theme.typography.sizes.s};
margin-bottom: ${({ theme }) => theme.gridUnit}px;
`;
export default ControlSubSectionHeader;

View File

@@ -29,6 +29,7 @@ export * from './components/InfoTooltipWithTrigger';
export * from './components/ColumnOption';
export * from './components/ColumnTypeLabel/ColumnTypeLabel';
export * from './components/MetricOption';
export * from './components/ControlSubSectionHeader';
export * from './shared-controls';
export * from './types';

View File

@@ -18,6 +18,8 @@
*/
import React from 'react';
import { t, RollingType, ComparisonType } from '@superset-ui/core';
import { ControlSubSectionHeader } from '../components/ControlSubSectionHeader';
import { ControlPanelSectionConfig } from '../types';
import { formatSelectOptions } from '../utils';
@@ -30,7 +32,7 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = {
'of query results',
),
controlSetRows: [
[<div className="section-header">{t('Rolling window')}</div>],
[<ControlSubSectionHeader>{t('Rolling window')}</ControlSubSectionHeader>],
[
{
name: 'rolling_type',
@@ -99,7 +101,7 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = {
},
},
],
[<div className="section-header">{t('Time comparison')}</div>],
[<ControlSubSectionHeader>{t('Time comparison')}</ControlSubSectionHeader>],
[
{
name: 'time_compare',
@@ -150,7 +152,7 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = {
},
},
],
[<div className="section-header">{t('Resample')}</div>],
[<ControlSubSectionHeader>{t('Resample')}</ControlSubSectionHeader>],
[
{
name: 'resample_rule',

View File

@@ -18,6 +18,8 @@
*/
import React from 'react';
import { t } from '@superset-ui/core';
import { ControlSubSectionHeader } from '../components/ControlSubSectionHeader';
import { ControlPanelSectionConfig } from '../types';
import { formatSelectOptions } from '../utils';
@@ -33,7 +35,7 @@ export const titleControls: ControlPanelSectionConfig = {
tabOverride: 'customize',
expanded: true,
controlSetRows: [
[<div className="section-header">{t('X Axis')}</div>],
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
[
{
name: 'x_axis_title',
@@ -61,7 +63,7 @@ export const titleControls: ControlPanelSectionConfig = {
},
},
],
[<div className="section-header">{t('Y Axis')}</div>],
[<ControlSubSectionHeader>{t('Y Axis')}</ControlSubSectionHeader>],
[
{
name: 'y_axis_title',
@@ -81,7 +83,7 @@ export const titleControls: ControlPanelSectionConfig = {
type: 'SelectControl',
freeForm: true,
clearable: true,
label: t('Y AXIS TITLE MARGIN'),
label: t('Y Axis Title Margin'),
renderTrigger: true,
default: TITLE_MARGIN_OPTIONS[0],
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
@@ -96,7 +98,7 @@ export const titleControls: ControlPanelSectionConfig = {
type: 'SelectControl',
freeForm: true,
clearable: false,
label: t('Y AXIS TITLE POSITION'),
label: t('Y Axis Title Position'),
renderTrigger: true,
default: TITLE_POSITION_OPTIONS[0][0],
choices: TITLE_POSITION_OPTIONS,