Skip to content

Commit

Permalink
Merge branch 'dsfr-plus' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Mar 29, 2024
2 parents 9a8a39f + 0b2eb4b commit 21f540a
Show file tree
Hide file tree
Showing 39 changed files with 2,867 additions and 1,206 deletions.
17 changes: 13 additions & 4 deletions client/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@
"object-curly-newline": "off",
"react/jsx-props-no-spreading": "off",
"react-hooks/exhaustive-deps": "warn",
"max-len": ["warn", 200],
"max-len": [
"warn",
200
],
"react/prop-types": "warn",
"import/prefer-default-export": 0,
"import/no-unresolved": "off",
"no-underscore-dangle": 0,
"no-console": "warn",
"indent": [
"warn",
2,
{
"ignoredNodes": ["TemplateLiteral"]
"ignoredNodes": [
"TemplateLiteral"
]
}
]
},
"extends": ["airbnb", "airbnb/hooks"]
}
"extends": [
"airbnb",
"airbnb/hooks"
]
}
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@dataesr/react-dsfr": "^3.9.2",
"@dataesr/dsfr-plus": "^0.2.0",
"@m4tt72/matomo-tracker-react": "^0.6.2",
"@tanstack/react-query": "^4.29.5",
"@tanstack/react-query-devtools": "^4.29.6",
Expand Down
79 changes: 79 additions & 0 deletions client/src/components/File/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

// import '@gouvfr/dsfr/dist/component/link/link.css';

const getAll = (props) => {
const newProps = {};

Object.keys(props).forEach((key) => {
if (key.startsWith('data-') || key === 'id') {
newProps[key] = props[key];
}
});

return newProps;
};

function File({
className,
label,
errorMessage,
hint,
onChange,
multiple,
accept,
...remainingProps
}) {
const _className = classNames(
'fr-upload-group',
className,
{
[`ds-fr--${label}`]: label,
},
);

return (
<div {...getAll(remainingProps)} className={_className}>
<label className="fr-label" htmlFor="file-upload">
{label}
{hint && <p className="fr-hint-text">{hint}</p>}
</label>
<input
onChange={onChange}
className="fr-upload"
type="file"
aria-describedby={hint || undefined}
multiple={multiple}
accept={accept}
/>
{errorMessage && (
<p id="file-upload-with-error-desc-error" className="fr-error-text">
{errorMessage}
</p>
)}
</div>
);
}

File.defaultProps = {
className: '',
hint: '',
errorMessage: '',
accept: undefined,
multiple: false,
onChange: () => { },
};

File.propTypes = {
className: PropTypes.string,
label: PropTypes.string.isRequired,
multiple: PropTypes.bool,
onChange: PropTypes.func,
errorMessage: PropTypes.string,
hint: PropTypes.string,
accept: PropTypes.string,
};

export default File;
2 changes: 1 addition & 1 deletion client/src/components/button-dropdown/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// https://www.w3schools.com/css/css_dropdowns.asp
import PropTypes from 'prop-types';
import { Button } from '@dataesr/dsfr-plus';
import useToast from '../../hooks/useToast';

import Button from '../button';
import { export2Csv, export2FosmCsv, export2jsonl } from '../../utils/files';
import { capitalize } from '../../utils/works';

Expand Down
187 changes: 0 additions & 187 deletions client/src/components/button/button.scss

This file was deleted.

Loading

0 comments on commit 21f540a

Please sign in to comment.