Skip to content

Commit 9621371

Browse files
Merge pull request #1415 from betagouv/remove_api_contents
Remove api contents
2 parents fd027b4 + a56da4f commit 9621371

File tree

8 files changed

+165
-284
lines changed

8 files changed

+165
-284
lines changed

components/api/apiDescription.tsx

Lines changed: 72 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { RichLink } from '../../uiComponents';
33
import RichReactMarkdown from '../../components/richReactMarkdown';
4-
import Section from '../../components/api/section';
54
import { IGuideElementShort } from '../../model';
65
import { H3WithAnchor } from '../../uiComponents/titleWithAnchor';
76
import slugify from 'slugify';
@@ -11,42 +10,76 @@ const ApiDescription: React.FC<{
1110
body: string;
1211
guides: IGuideElementShort[];
1312
title: string;
14-
}> = ({ content_intro, guides, body, title }) => (
15-
<Section id="api-description" title="Description">
16-
<>
17-
<div style={{backgroundColor: "#FFE9E6", color: "#B34000", padding: "1rem"}}>
18-
<strong>⚠️ Ces informations ne sont plus mises à jour depuis le 20/11/2024.</strong><br />
19-
Le site API.gouv.fr va progressivement être fusionné dans le catalogue unique data.gouv.fr. <br /><br />
20-
Retrouvez la fiche d'information à jour de cette API sur la nouvelle page API de Data.gouv.fr <a href={`https://data.gouv.fr/fr/dataservices/${slugify(title.replace(/[|&$%<>]/g, ""))}`} target="_blank" rel="noopener noreferrer">⇢ Consulter la fiche à jour</a>
13+
}> = ({ title }) => {
14+
const [searchQuery, setSearchQuery] = useState(title);
15+
16+
const handleSearch = (e: React.FormEvent) => {
17+
e.preventDefault();
18+
const encodedQuery = encodeURIComponent(searchQuery);
19+
window.location.href = `https://www.data.gouv.fr/fr/dataservices/?q=${encodedQuery}`;
20+
};
21+
22+
return (
23+
<div className="deprecation-notice">
24+
<div className="search-container">
25+
<h1>Rechercher "{title}" sur data.gouv.fr</h1>
26+
<form onSubmit={handleSearch} className="search-form">
27+
<input
28+
type="text"
29+
value={searchQuery}
30+
onChange={(e) => setSearchQuery(e.target.value)}
31+
placeholder="Rechercher sur data.gouv.fr..."
32+
className="search-input"
33+
/>
34+
<button type="submit" className="search-button">
35+
Rechercher sur data.gouv.fr
36+
</button>
37+
</form>
2138
</div>
22-
23-
{content_intro && <RichReactMarkdown source={content_intro} />}
24-
{guides.length > 0 && (
25-
<>
26-
<H3WithAnchor>Exemples d’application</H3WithAnchor>
27-
<div className="default-grid api-examples">
28-
{guides.map(guide => (
29-
<RichLink
30-
key={guide.slug}
31-
title={guide.title}
32-
image={
33-
guide.image
34-
? `/images/guides/thumbnail_${guide.image}`
35-
: undefined
36-
}
37-
href={`/guides/${guide.slug}`}
38-
/>
39-
))}
40-
</div>
41-
</>
42-
)}
43-
<RichReactMarkdown source={body} />
44-
</>
45-
<style jsx>{`
46-
.api-examples {
47-
margin-bottom: 40px;
48-
}
49-
`}</style>
50-
</Section>
51-
);
39+
40+
<style jsx>{`
41+
.deprecation-notice {
42+
max-width: 800px;
43+
margin: 0 auto;
44+
padding: 2rem;
45+
}
46+
47+
.search-container {
48+
text-align: center;
49+
margin-top: 2rem;
50+
}
51+
52+
.search-form {
53+
display: flex;
54+
gap: 1rem;
55+
max-width: 600px;
56+
margin: 5rem auto;
57+
}
58+
59+
.search-input {
60+
flex: 1;
61+
padding: 0.75rem;
62+
border: 1px solid #ccc;
63+
border-radius: 4px;
64+
font-size: 1rem;
65+
}
66+
67+
.search-button {
68+
padding: 0.75rem 1.5rem;
69+
background-color: #000091;
70+
color: white;
71+
border: none;
72+
border-radius: 4px;
73+
cursor: pointer;
74+
font-size: 1rem;
75+
}
76+
77+
.search-button:hover {
78+
background-color: #1212ff;
79+
}
80+
`}</style>
81+
</div>
82+
);
83+
};
84+
5285
export default ApiDescription;

components/api/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import Partners from './partners';
44
import TechnicalDocumentation from './technical-documentation';
55
import ApiRelatedServices from './apiRelatedServices.tsx';
66
import ApiOpenDataSources from './apiOpenDataSources.tsx';
7-
import PageHeader from './pageHeader';
87
import ApiDescription from './apiDescription';
98

109
export {
11-
PageHeader,
1210
Access,
1311
SupportAndTeam,
1412
Partners,

components/api/pageHeader.tsx

Lines changed: 0 additions & 103 deletions
This file was deleted.

components/api/section.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ const Section = ({ id, title, children }) => {
77
This is a hidden anchor. It is a trick to avoid having the header hiding
88
the top of the page.
99
</a>
10-
<h2 className="ui dividing header">
11-
<a
12-
href={`#${id}`}
13-
aria-hidden="true"
14-
tabIndex="-1"
15-
className="header-anchor"
16-
>
17-
#
18-
</a>
19-
{title}
20-
</h2>
10+
{title && (
11+
<h2 className="ui dividing header">
12+
<a
13+
href={`#${id}`}
14+
aria-hidden="true"
15+
tabIndex="-1"
16+
className="header-anchor"
17+
>
18+
#
19+
</a>
20+
{title}
21+
</h2>
22+
)}
2123

2224
{children}
2325

components/footer/preFooter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const PreFooter = ({ background }) => (
2121
</div>
2222
<div>
2323
<p>Vous voulez partager une API ?</p>
24-
<ButtonLink href={constants.links.ADD_API} alt>
24+
<ButtonLink href="https://guides.data.gouv.fr/guide-data.gouv.fr/api/publier-une-api" alt>
2525
Partager votre API
2626
</ButtonLink>
2727
</div>

pages/les-api/[slug].tsx

Lines changed: 11 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import Page from '../../layouts';
1414

1515
import {
16-
PageHeader,
1716
Access,
1817
SupportAndTeam,
1918
Partners,
@@ -26,7 +25,6 @@ import ApiDetails from '../../components/api/apiDetails';
2625
import { HEADER_PAGE } from '../../components';
2726

2827
import constants from '../../constants';
29-
import Feedback from '../../components/feedback';
3028
import { IDataGouvDataset, fetchDatagouvDatasets } from '../../components/api/apiOpenDataSources';
3129

3230
interface IProps {
@@ -74,93 +72,24 @@ const API: React.FC<IProps> = ({ api, guides, datagouvDatasets }) => {
7472
canonical={`https://api.gouv.fr/les-api/${slug}`}
7573
usePreFooter={!hide_pre_footer}
7674
>
77-
<PageHeader
78-
title={title}
79-
logo={logo || constants.logo}
80-
tagline={tagline}
81-
owner={owner}
82-
owner_acronym={owner_acronym}
83-
owner_slug={owner_slug}
84-
/>
85-
8675
<div id="description" className="fr-container">
87-
<div className="right-column-grid">
88-
<div className="left-column text-style">
89-
<ApiDescription
90-
guides={guides}
91-
body={body}
92-
content_intro={content_intro}
93-
title={title}
94-
/>
95-
96-
{datagouvDatasets.length > 0 && (
97-
<ApiOpenDataSources datasetsList={datagouvDatasets} />
98-
)}
99-
100-
<Feedback />
101-
</div>
102-
<div className="right-column info-column">
103-
<Access
104-
is_open={is_open}
105-
slug={slug}
106-
doc_swagger_link={doc_tech_link}
107-
doc_external_link={doc_tech_external}
108-
account_link={account_link}
109-
/>
110-
<SupportAndTeam
111-
logo={logo}
112-
owner={owner}
113-
owner_acronym={owner_acronym}
114-
owner_slug={owner_slug}
115-
link={contact_link}
116-
/>
117-
<TechnicalDocumentation
118-
swagger_link={doc_tech_link}
119-
external_link={doc_tech_external}
120-
slug={slug}
121-
/>
122-
<ApiDetails
123-
monitoring={monitoring_description}
124-
monitoring_link={monitoring_link}
125-
rate_limiting={rate_limiting_description}
126-
rate_limiting_resume={rate_limiting_resume}
127-
rate_limiting_link={rate_limiting_link}
128-
stats_detail={stats_detail_description}
129-
stats_detail_resume={stats_detail_resume}
130-
stats_detail_link={stats_detail_link}
131-
uptime={uptime}
132-
is_france_connected={is_france_connected}
133-
/>
134-
135-
<Partners partners={partners} />
136-
</div>
76+
<div className="text-style">
77+
<ApiDescription
78+
guides={guides}
79+
body={body}
80+
content_intro={content_intro}
81+
title={title}
82+
/>
83+
84+
{datagouvDatasets.length > 0 && (
85+
<ApiOpenDataSources datasetsList={datagouvDatasets} />
86+
)}
13787
</div>
13888
</div>
13989
<style jsx>{`
14090
#description {
14191
margin-bottom: 70px;
14292
}
143-
144-
.right-column-grid {
145-
display: grid;
146-
grid-template-columns: 65% 31%;
147-
grid-gap: 40px;
148-
}
149-
150-
.info-column {
151-
border-left: 2px solid ${constants.colors.lightBlue};
152-
padding: 0 0 0 40px;
153-
}
154-
@media only screen and (min-width: 1px) and (max-width: 900px) {
155-
.right-column-grid {
156-
display: flex;
157-
flex-direction: column-reverse;
158-
}
159-
.info-column {
160-
border: none;
161-
padding: 0;
162-
}
163-
}
16493
`}</style>
16594
</Page>
16695
);

0 commit comments

Comments
 (0)