Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-10064] Update spacing for below-chart elements #1798

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/chart/src/CdcChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ const CdcChart = ({
}

const getChartSubTextClasses = () => {
const classes = ['subtext ']
const classes = ['subtext mt-4']
const isLegendOnBottom = legend?.position === 'bottom' || isLegendWrapViewport(currentViewport)

if (config.isResponsiveTicks) classes.push('subtext--responsive-ticks ')
Expand Down Expand Up @@ -1465,8 +1465,8 @@ const CdcChart = ({
)}
{config?.annotations?.length > 0 && <Annotation.Dropdown />}
{/* show pdf or image button */}
{config?.footnotes && <section className='footnotes pt-2 mt-4'>{parse(config.footnotes)}</section>}
</div>
{config?.footnotes && <section className='footnotes'>{parse(config.footnotes)}</section>}
</div>
)}
</Layout.Responsive>
Expand Down
5 changes: 0 additions & 5 deletions packages/chart/src/scss/DataTable.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
.data-table-container {
margin: 20px 0 0;

&.brush-active {
margin: 80px 0 0;
}

width: 100%;
&.download-link-above {
margin: 0;
}
}

.data-table-container {
Expand Down
14 changes: 7 additions & 7 deletions packages/core/components/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,12 @@ const DataTable = (props: DataTableProps) => {
const getMediaControlsClasses = belowTable => {
const classes = ['download-links']
if (!belowTable) {
classes.push('mt-4', 'mb-2')
const isLegendOnBottom = config?.legend?.position === 'bottom' || isLegendWrapViewport(viewport)
if (config.brush?.active && !isLegendOnBottom) classes.push('brush-active')
if (config.brush?.active && config.legend.hide) classes.push('brush-active')
} else {
classes.push('below-table')
classes.push('mt-2')
}
return classes
}
Expand All @@ -246,19 +247,18 @@ const DataTable = (props: DataTableProps) => {
}
const getClassNames = (): string => {
const classes = ['data-table-container']
const isBrushActive = config?.brush?.active && config.legend?.position !== 'bottom'

if (config.table.showDownloadLinkBelow) {
classes.push('mt-4')
}

const isBrushActive = config?.brush?.active && config.legend?.position !== 'bottom'
if (isBrushActive) {
classes.push('brush-active')
}

classes.push(viewport)

const downloadLinkClass = !config.table.showDownloadLinkBelow ? 'download-link-above' : ''
if (downloadLinkClass) {
classes.push(downloadLinkClass)
}

return classes.join(' ')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const ExpandCollapse = ({ expanded, setExpanded, tableTitle, fontSize, viewport
return (
<div
role='button'
className={expanded ? 'data-table-heading' : 'collapsed data-table-heading'}
className={expanded ? 'data-table-heading p-3' : 'collapsed data-table-heading p-3'}
onClick={() => {
setExpanded(!expanded)
}}
Expand Down
1 change: 0 additions & 1 deletion packages/core/components/DataTable/data-table.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
.cdc-open-viz-module div.data-table-heading {
position: relative;
background: rgba(0, 0, 0, 0.05);
padding: 0.5em 0.7em;
border: var(--lightGray) 1px solid;

svg {
Expand Down
5 changes: 1 addition & 4 deletions packages/core/styles/_button-section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
display: flex;
justify-content: flex-end;
width: 100%;
line-height: 1;
&.brush-active {
margin-top: 2em;
}
Expand All @@ -26,10 +27,6 @@
& a {
font-size: var(--download-link-font-size);
}
margin-top: 20px;
&.below-table {
margin-top: 5px;
}
}

// odd wrapper thats different on dashboards
Expand Down
10 changes: 2 additions & 8 deletions packages/core/styles/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,7 @@ section.introText {

section.footnotes {
border-top: 1px solid #ddd;
margin-top: 20px;
padding: 15px;
}

.cdc-chart-inner-container .subtext {
margin-top: 20px;
width: 100%;
}

.margin-left-href {
Expand All @@ -182,7 +177,6 @@ section.footnotes {
}
}


// after migration to TP5 this declaration should be removed and all references
// to it should be replaced with .form-select
.cove-form-select {
Expand All @@ -192,4 +186,4 @@ section.footnotes {
border-radius: 0.25rem;
border: 1px solid var(--lightGray);
color: var(--darkGray);
}
}
7 changes: 0 additions & 7 deletions packages/dashboard/src/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@
margin: 15px 0 0;
}

.data-table-container {
margin: 20px 0 0;
&.download-link-above {
margin: 0;
}
}

.collapsable-multiviz-container {
position: relative;
border: var(--lightGray) 1px solid;
Expand Down
2 changes: 1 addition & 1 deletion packages/map/src/components/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const DataTable = props => {

const TableMediaControls = ({ belowTable }) => {
return (
<MediaControls.Section classes={['download-links'] + (belowTable ? 'below-table' : '')}>
<MediaControls.Section classes={['download-links']}>
<MediaControls.Link config={state} />
{state.general.showDownloadButton && <DownloadButton />}
</MediaControls.Section>
Expand Down
7 changes: 0 additions & 7 deletions packages/map/src/scss/map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,3 @@ canvas {
pointer-events: none;
display: none;
}

.data-table-container {
margin: 20px 0px 0px;
&.download-link-above {
margin-top: 0;
}
}
Loading