Skip to content

Commit

Permalink
chore: make control panel sub sections look better (#24736)
Browse files Browse the repository at this point in the history
(cherry picked from commit 22a0fe5)
  • Loading branch information
mistercrunch authored and michael-s-molina committed Jul 24, 2023
1 parent 2e22286 commit 299dbb7
Show file tree
Hide file tree
Showing 25 changed files with 145 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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',
Expand Down Expand Up @@ -99,7 +101,7 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = {
},
},
],
[<div className="section-header">{t('Time comparison')}</div>],
[<ControlSubSectionHeader>{t('Time comparison')}</ControlSubSectionHeader>],
[
{
name: 'time_compare',
Expand Down Expand Up @@ -150,7 +152,7 @@ export const advancedAnalyticsControls: ControlPanelSectionConfig = {
},
},
],
[<div className="section-header">{t('Resample')}</div>],
[<ControlSubSectionHeader>{t('Resample')}</ControlSubSectionHeader>],
[
{
name: 'resample_rule',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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),
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { t, validateNonEmpty } from '@superset-ui/core';
import {
ColumnMeta,
ControlPanelConfig,
ControlSubSectionHeader,
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
Expand Down Expand Up @@ -241,7 +242,11 @@ const config: ControlPanelConfig = {
),
controlSetRows: [
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Rolling Window')}</div>],
[
<ControlSubSectionHeader>
{t('Rolling Window')}
</ControlSubSectionHeader>,
],
[
{
name: 'rolling_type',
Expand Down Expand Up @@ -293,7 +298,11 @@ const config: ControlPanelConfig = {
},
],
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Time Comparison')}</div>],
[
<ControlSubSectionHeader>
{t('Time Comparison')}
</ControlSubSectionHeader>,
],
[
{
name: 'time_compare',
Expand Down Expand Up @@ -342,7 +351,7 @@ const config: ControlPanelConfig = {
},
},
],
[<div className="section-header">{t('Resample')}</div>],
[<ControlSubSectionHeader>{t('Resample')}</ControlSubSectionHeader>],
[
{
name: 'resample_rule',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from 'react';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlSubSectionHeader,
D3_FORMAT_DOCS,
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
Expand Down Expand Up @@ -123,7 +124,11 @@ const config: ControlPanelConfig = {
),
controlSetRows: [
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Rolling Window')}</div>],
[
<ControlSubSectionHeader>
{t('Rolling Window')}
</ControlSubSectionHeader>,
],
[
{
name: 'rolling_type',
Expand Down Expand Up @@ -175,7 +180,11 @@ const config: ControlPanelConfig = {
},
],
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Time Comparison')}</div>],
[
<ControlSubSectionHeader>
{t('Time Comparison')}
</ControlSubSectionHeader>,
],
[
{
name: 'time_compare',
Expand Down Expand Up @@ -224,7 +233,7 @@ const config: ControlPanelConfig = {
},
},
],
[<div className="section-header">{t('Resample')}</div>],
[<ControlSubSectionHeader>{t('Resample')}</ControlSubSectionHeader>],
[
{
name: 'resample_rule',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import React from 'react';
import { t } from '@superset-ui/core';
import {
ControlPanelSectionConfig,
ControlSubSectionHeader,
CustomControlItem,
D3_TIME_FORMAT_OPTIONS,
D3_FORMAT_DOCS,
Expand Down Expand Up @@ -390,7 +391,11 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
'of query results',
),
controlSetRows: [
[<div className="section-header">{t('Rolling Window')}</div>],
[
<ControlSubSectionHeader>
{t('Rolling Window')}
</ControlSubSectionHeader>,
],
[
{
name: 'rolling_type',
Expand Down Expand Up @@ -443,7 +448,11 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
},
},
],
[<div className="section-header">{t('Time Comparison')}</div>],
[
<ControlSubSectionHeader>
{t('Time Comparison')}
</ControlSubSectionHeader>,
],
[
{
name: 'time_compare',
Expand Down Expand Up @@ -494,7 +503,7 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [
},
},
],
[<div className="section-header">{t('Resample')}</div>],
[<ControlSubSectionHeader>{t('Resample')}</ControlSubSectionHeader>],
[
{
name: 'resample_rule',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { hasGenericChartAxes, smartDateFormatter, t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlSubSectionHeader,
D3_FORMAT_DOCS,
D3_TIME_FORMAT_OPTIONS,
getStandardizedControls,
Expand Down Expand Up @@ -170,7 +171,11 @@ const config: ControlPanelConfig = {
expanded: false,
controlSetRows: [
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Rolling Window')}</div>],
[
<ControlSubSectionHeader>
{t('Rolling Window')}
</ControlSubSectionHeader>,
],
[
{
name: 'rolling_type',
Expand Down Expand Up @@ -223,7 +228,7 @@ const config: ControlPanelConfig = {
},
},
],
[<div className="section-header">{t('Resample')}</div>],
[<ControlSubSectionHeader>{t('Resample')}</ControlSubSectionHeader>],
[
{
name: 'resample_rule',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from 'react';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlSubSectionHeader,
D3_FORMAT_OPTIONS,
D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT,
sections,
Expand Down Expand Up @@ -77,7 +78,7 @@ const config: ControlPanelConfig = {
['color_scheme'],
...funnelLegendSection,
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Labels')}</div>],
[<ControlSubSectionHeader>{t('Labels')}</ControlSubSectionHeader>],
[
{
name: 'label_type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { t } from '@superset-ui/core';
import {
sharedControls,
ControlPanelConfig,
ControlSubSectionHeader,
D3_FORMAT_OPTIONS,
sections,
getStandardizedControls,
Expand Down Expand Up @@ -73,7 +74,7 @@ const config: ControlPanelConfig = {
label: t('Chart Options'),
expanded: true,
controlSetRows: [
[<div className="section-header">{t('General')}</div>],
[<ControlSubSectionHeader>{t('General')}</ControlSubSectionHeader>],
[
{
name: 'min_val',
Expand Down Expand Up @@ -193,7 +194,7 @@ const config: ControlPanelConfig = {
},
},
],
[<div className="section-header">{t('Axis')}</div>],
[<ControlSubSectionHeader>{t('Axis')}</ControlSubSectionHeader>],
[
{
name: 'show_axis_tick',
Expand Down Expand Up @@ -232,7 +233,7 @@ const config: ControlPanelConfig = {
},
},
],
[<div className="section-header">{t('Progress')}</div>],
[<ControlSubSectionHeader>{t('Progress')}</ControlSubSectionHeader>],
[
{
name: 'show_progress',
Expand Down Expand Up @@ -273,7 +274,7 @@ const config: ControlPanelConfig = {
},
},
],
[<div className="section-header">{t('Intervals')}</div>],
[<ControlSubSectionHeader>{t('Intervals')}</ControlSubSectionHeader>],
[
{
name: 'intervals',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from 'react';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlSubSectionHeader,
getStandardizedControls,
sections,
sharedControls,
Expand Down Expand Up @@ -99,7 +100,7 @@ const controlPanel: ControlPanelConfig = {
controlSetRows: [
['color_scheme'],
...legendSection,
[<div className="section-header">{t('Layout')}</div>],
[<ControlSubSectionHeader>{t('Layout')}</ControlSubSectionHeader>],
[
{
name: 'layout',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
ControlPanelConfig,
ControlPanelSectionConfig,
ControlSetRow,
ControlSubSectionHeader,
CustomControlItem,
getStandardizedControls,
sections,
Expand Down Expand Up @@ -128,7 +129,7 @@ function createCustomizeSection(
controlSuffix: string,
): ControlSetRow[] {
return [
[<div className="section-header">{label}</div>],
[<ControlSubSectionHeader>{label}</ControlSubSectionHeader>],
[
{
name: `seriesType${controlSuffix}`,
Expand Down Expand Up @@ -311,7 +312,7 @@ const config: ControlPanelConfig = {
},
],
...legendSection,
[<div className="section-header">{t('X Axis')}</div>],
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
['x_axis_time_format'],
[
{
Expand All @@ -335,7 +336,7 @@ const config: ControlPanelConfig = {
],
...richTooltipSection,
// eslint-disable-next-line react/jsx-key
[<div className="section-header">{t('Y Axis')}</div>],
[<ControlSubSectionHeader>{t('Y Axis')}</ControlSubSectionHeader>],
[
{
name: 'minorSplitLine',
Expand Down
Loading

0 comments on commit 299dbb7

Please sign in to comment.