Skip to content

Commit

Permalink
Make first tab open
Browse files Browse the repository at this point in the history
  • Loading branch information
kreafox committed Mar 1, 2023
1 parent 792aeec commit e578106
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
6 changes: 4 additions & 2 deletions src/components/ItemView/Datasets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const Datasets = (props) => {
const { item, appConfig } = props;
const { children } = item?.raw_value?.raw || {};

const [activeIndex, setActiveIndex] = React.useState(-1);
const [activeIndex, setActiveIndex] = React.useState(0);

function handleClick(e, titleProps) {
const { index } = titleProps;
Expand Down Expand Up @@ -318,7 +318,9 @@ const Datasets = (props) => {

const panes = (groupedDatasets || []).map((item, i) => ({
menuItem: (
<Menu.Item>{item.date ? <span>{item.date}</span> : 'No date'}</Menu.Item>
<Menu.Item key={i}>
{item.date ? <span>{item.date}</span> : 'No date'}
</Menu.Item>
),
render: () => (
<Tab.Pane>
Expand Down
10 changes: 1 addition & 9 deletions src/components/ItemView/ItemView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,7 @@ function ItemView(props) {
<Banner>
<Banner.Content>
<Banner.Subtitle>
<Link
to={
location?.state
? { pathname: fromPathname, search: fromSearch }
: {
pathname: '/en/datahub/',
}
}
>
<Link to={appConfig.landingPageURL}>
<Icon className="arrow left" />
Datahub overview
</Link>
Expand Down
12 changes: 2 additions & 10 deletions src/components/Result/DatahubCardItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,10 @@ const DatahubCardItem = (props) => {
// if (metaType.length === 0) {
// metaType = 'Others';
// }

const item = {
title: (
<Link
to={{
pathname: result.href,
state: {
fromPathname: window.location.pathname,
fromSearch: window.location.search,
},
}}
title={result.title}
>
<Link to={result.href} title={result.title}>
{result.title}
</Link>
),
Expand Down

0 comments on commit e578106

Please sign in to comment.