forked from amundsen-io/amundsen
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Leverages existing bootstrap-react tab components
- Loading branch information
Daniel
authored and
Hans Adriaans
committed
Jun 30, 2022
1 parent
4f1fd52
commit a44c573
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
frontend/amundsen_application/static/js/components/common/Tabs/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as React from 'react'; | ||
import { Tab, Tabs } from 'react-bootstrap'; | ||
|
||
import './styles.scss'; | ||
|
||
export interface TabsProps { | ||
tabs: TabInfo[]; | ||
|
||
defaultTab?: string; | ||
onSelect?: (key: string) => void; | ||
} | ||
|
||
interface TabInfo { | ||
content: JSX.Element; | ||
key: string; | ||
title: string; | ||
} | ||
|
||
const TabsComponent: React.SFC<TabsProps> = ({tabs, defaultTab, onSelect}) => { | ||
return ( | ||
<Tabs | ||
id="tab" | ||
className="tabs-component" | ||
defaultActiveKey={ defaultTab } | ||
onSelect={ onSelect } | ||
> | ||
{ | ||
tabs.map((tab) => { | ||
return ( | ||
<Tab title={ tab.title } eventKey={ tab.key } key={ tab.key }> | ||
{ tab.content } | ||
</Tab> | ||
) | ||
}) | ||
} | ||
</Tabs> | ||
) | ||
}; | ||
|
||
export default TabsComponent; |
44 changes: 44 additions & 0 deletions
44
frontend/amundsen_application/static/js/components/common/Tabs/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@import 'variables'; | ||
|
||
.tabs-component { | ||
.nav.nav-tabs { | ||
border: none; | ||
|
||
> li { | ||
&.active > a { | ||
&, | ||
&:hover { | ||
color: $gradient-4; | ||
} | ||
|
||
&:after { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
> a { | ||
background: none; | ||
border: none; | ||
color: $gray-light; | ||
font-size: $font-size-large; | ||
line-height: $line-height-large; | ||
|
||
&:hover { | ||
color: $text-color; | ||
} | ||
|
||
// Active tab indicator | ||
&:after { | ||
border: 2px solid $gradient-4; | ||
bottom: 0; | ||
content: ""; | ||
left: 0; | ||
opacity: 0; | ||
position: absolute; | ||
transition: opacity 200ms ease-in; | ||
width: 100%; | ||
} | ||
} | ||
} | ||
} | ||
} |