Skip to content

Commit

Permalink
Fix layput issue for small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasaifee42 committed Jun 10, 2024
1 parent 237ac4c commit 296c7d2
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 66 deletions.
36 changes: 18 additions & 18 deletions src/BarChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,27 @@ export function BarChart(props: Props) {
income {domain[0]} - {domain[1]}
</h6>
<div className='flex-div flex-vert-align-center no-shrink'>
<DownloadImageButton element={divToBeDownloaded} />
<DownloadDataButton link='https://github.com/UNDP-Data/dv-debt-all-data-repo/raw/main/ExcelData/ExternalDebtService.xlsx' />
</div>
</div>
<div className='margin-bottom-07 flex-div flex-vert-align-center'>
<Select
options={categories.map(d => ({
label: d.description,
value: d.description,
}))}
className='undp-select'
style={{ width: '100%' }}
onChange={el => {
setCategorySelection(el);
}}
value={categorySelection}
/>
<div className='no-shrink flex-div flex-vert-align-center'>
<Radio.Group
optionType='button'
className='undp-button-radio'
size='small'
defaultValue={totalPercentSelection}
onChange={(el: RadioChangeEvent) => {
setTotalPercentSelection(el.target.value);
Expand All @@ -68,7 +85,6 @@ export function BarChart(props: Props) {
<Radio.Group
optionType='button'
className='undp-button-radio'
size='small'
defaultValue={revenueExportsSelection}
onChange={(el: RadioChangeEvent) => {
setRevenueExportsSelection(el.target.value);
Expand All @@ -80,24 +96,8 @@ export function BarChart(props: Props) {
</Radio>
))}
</Radio.Group>
<DownloadImageButton element={divToBeDownloaded} />
<DownloadDataButton link='https://github.com/UNDP-Data/dv-debt-all-data-repo/raw/main/ExcelData/ExternalDebtService.xlsx' />
</div>
</div>
<div className='margin-bottom-07'>
<Select
options={categories.map(d => ({
label: d.description,
value: d.description,
}))}
className='undp-select'
style={{ width: '100%' }}
onChange={el => {
setCategorySelection(el);
}}
value={categorySelection}
/>
</div>
<Graph
data={data.filter(d => d.Group === categorySelection)}
totalPercentOption={totalPercentSelection}
Expand Down
33 changes: 17 additions & 16 deletions src/DebtInterestBars/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,13 @@ export function DebtInterestBars(props: Props) {
percent of revenue today relative to a decade ago
</h6>
<div className='flex-div flex-vert-align-center no-shrink'>
<Radio.Group
optionType='button'
className='undp-button-radio'
size='small'
defaultValue={totalPercentSelection}
onChange={(el: RadioChangeEvent) => {
setTotalPercentSelection(el.target.value);
}}
>
{numberPercentOptions.map((d, i) => (
<Radio key={i} className='undp-radio' value={d}>
{d}
</Radio>
))}
</Radio.Group>
{divToBeDownloaded ? (
<DownloadImageButton element={divToBeDownloaded} />
) : null}
<DownloadDataButton link='https://github.com/UNDP-Data/dv-debt-all-data-repo/raw/main/ExcelData/DebtNetInterest.xlsx' />
</div>
</div>
<div className='margin-bottom-07'>
<div className='margin-bottom-07 flex-div flex-vert-align-center'>
<Select
options={categories.map(d => ({
label: d.description,
Expand All @@ -67,6 +52,22 @@ export function DebtInterestBars(props: Props) {
}}
value={categorySelection}
/>
<div className='flex-div no-shrink'>
<Radio.Group
optionType='button'
className='undp-button-radio'
defaultValue={totalPercentSelection}
onChange={(el: RadioChangeEvent) => {
setTotalPercentSelection(el.target.value);
}}
>
{numberPercentOptions.map((d, i) => (
<Radio key={i} className='undp-radio' value={d}>
{d}
</Radio>
))}
</Radio.Group>
</div>
</div>
<Graph
data={data.filter(
Expand Down
33 changes: 17 additions & 16 deletions src/QuantilesLineChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,11 @@ export function QuantilesLineChart(props: Props) {
{Math.max(...dateDomain)})
</h6>
<div className='flex-div flex-vert-align-center no-shrink'>
<Radio.Group
optionType='button'
className='undp-button-radio'
size='small'
defaultValue={totalExternalSelection}
onChange={(el: RadioChangeEvent) =>
setTotalExternalSelection(el.target.value)
}
>
{totalExternalOptions.map((d, i) => (
<Radio key={i} className='undp-radio' value={d}>
{d[0].toUpperCase() + d.slice(1)}
</Radio>
))}
</Radio.Group>
<DownloadImageButton element={divToBeDownloaded} />
<DownloadDataButton link='https://github.com/UNDP-Data/dv-debt-all-data-repo/raw/main/ExcelData/DebtToGDPQuantile.xlsx' />
</div>
</div>
<div className='margin-bottom-07'>
<div className='margin-bottom-07 flex-div flex-vert-align-center'>
<Select
options={categories.map(d => ({
label: d.description,
Expand All @@ -68,6 +53,22 @@ export function QuantilesLineChart(props: Props) {
}}
value={categorySelection}
/>
<div className='flex-div no-shrink'>
<Radio.Group
optionType='button'
className='undp-button-radio'
defaultValue={totalExternalSelection}
onChange={(el: RadioChangeEvent) =>
setTotalExternalSelection(el.target.value)
}
>
{totalExternalOptions.map((d, i) => (
<Radio key={i} className='undp-radio' value={d}>
{d[0].toUpperCase() + d.slice(1)}
</Radio>
))}
</Radio.Group>
</div>
</div>
<Graph
data={data.filter(d => d.Group === categorySelection)}
Expand Down
33 changes: 17 additions & 16 deletions src/StackedBarChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,11 @@ export function StackedBarChart(props: Props) {
rating classes
</h6>
<div className='flex-div flex-vert-align-center no-shrink'>
<Radio.Group
optionType='button'
className='undp-button-radio'
size='small'
defaultValue={creditDsaSelection}
onChange={(el: RadioChangeEvent) => {
setCreditDsaSelection(el.target.value);
}}
>
{creditDsaOptions.map((d, i) => (
<Radio key={i} className='undp-radio' value={d}>
{d}
</Radio>
))}
</Radio.Group>
<DownloadImageButton element={divToBeDownloaded} />
<DownloadDataButton link='https://github.com/UNDP-Data/dv-debt-all-data-repo/raw/main/ExcelData/CreditAndDSARating.xlsx' />
</div>
</div>
<div className='margin-bottom-07'>
<div className='margin-bottom-07 flex-div flex-vert-align-center'>
<Select
options={categories.map(d => ({
label: d.description,
Expand All @@ -92,6 +77,22 @@ export function StackedBarChart(props: Props) {
}}
value={categorySelection}
/>
<div className='flex-div no-shrink'>
<Radio.Group
optionType='button'
className='undp-button-radio'
defaultValue={creditDsaSelection}
onChange={(el: RadioChangeEvent) => {
setCreditDsaSelection(el.target.value);
}}
>
{creditDsaOptions.map((d, i) => (
<Radio key={i} className='undp-radio' value={d}>
{d}
</Radio>
))}
</Radio.Group>
</div>
</div>
<div ref={containerRef}>
<Graph data={selectedData} svgWidth={svgWidth} />
Expand Down

0 comments on commit 296c7d2

Please sign in to comment.