Skip to content

Commit

Permalink
disabled xlsx download for current page
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Feb 28, 2024
1 parent d7bb14e commit 40974ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
31 changes: 19 additions & 12 deletions pages/datasets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Props = {
data: any;
facets: any;
};

export const sortItems = [
{
id: 'bidOpeningDate:asc',
Expand All @@ -51,8 +52,10 @@ export const sortItems = [
name: 'Relevance',
},
];
const defaultSort = 'bidOpeningDate:asc';

const filterList = '"organization", "fiscalYear", "mainProcurementCategory"';

export function formatFilterName(name: string) {
if (name == 'fiscalYear') {
return 'fiscal year';
Expand All @@ -62,8 +65,6 @@ export function formatFilterName(name: string) {
else return name;
}

const defaultSort = 'bidOpeningDate:asc';

const Datasets: React.FC<Props> = ({ data, facets }) => {
const router = useRouter();
const { q, sort, size, fq, from } = router.query;
Expand Down Expand Up @@ -255,30 +256,36 @@ const Datasets: React.FC<Props> = ({ data, facets }) => {
setDownloadType(e.target.value)
}
>
<label htmlFor="downloadFormat1">
<label htmlFor="downloadFormat2">
<input
type="radio"
id="downloadFormat1"
id="downloadFormat2"
name="dialog-download"
value="xlsx"
value="json"
defaultChecked
/>
XLSX File{' '}
JSON File{' '}
{downloadMethod === 'download-all' ? (
<span>(~6MB)</span>
<span>(~27MB)</span>
) : null}
</label>

<label htmlFor="downloadFormat2">
<label htmlFor="downloadFormat1">
<input
type="radio"
id="downloadFormat2"
id="downloadFormat1"
name="dialog-download"
value="json"
value="xlsx"
disabled={downloadMethod !== 'download-all'}
/>
JSON File{' '}
XLSX File
{downloadMethod === 'download-all' ? (
<span>(~27MB)</span>
<span>(~6MB)</span>
) : null}
{downloadMethod !== 'download-all' ? (
<span className="text-xs">
(Not supported)
</span>
) : null}
</label>
</fieldset>
Expand Down
10 changes: 10 additions & 0 deletions styles/components/shared/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@
margin-left: 8px;
color: $text-light-medium;
}

label {
&:has(input:disabled) {
color: $text-light-medium;

span {
font-size: 0.75rem;
}
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,12 @@ button {
margin-left: 8px;
color: hsla(0, 0%, 0%, 0.6);
}
.dialog__format fieldset label:has(input:disabled) {
color: hsla(0, 0%, 0%, 0.6);
}
.dialog__format fieldset label:has(input:disabled) span {
font-size: 0.75rem;
}
.dialog__submit {
justify-self: center;
margin-top: 1rem;
Expand Down

0 comments on commit 40974ac

Please sign in to comment.