mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-26 21:13:15 +00:00
basic tabs component added
This commit is contained in:
15
ui/src/components/AdminSettings/AdminSettings.tsx
Normal file
15
ui/src/components/AdminSettings/AdminSettings.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import BasicTabs from "../UI/BasicTab/BasicTabs";
|
||||||
|
import Tab from "../UI/BasicTab/Tab";
|
||||||
|
|
||||||
|
const AdminSettings: React.FC = () => {
|
||||||
|
return (
|
||||||
|
<div style={{overflowY:"auto", height:"100%", backgroundColor:"white",color:"$494677",borderRadius:"4px",padding:"10px",position:"relative",display: 'inline-block',}}>
|
||||||
|
<BasicTabs>
|
||||||
|
<Tab title="USERS">USERS</Tab>
|
||||||
|
<Tab title="WORKSPACE">WORKSPACE</Tab>
|
||||||
|
</BasicTabs>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AdminSettings;
|
37
ui/src/components/UI/BasicTab/BasicTabs.tsx
Normal file
37
ui/src/components/UI/BasicTab/BasicTabs.tsx
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import React, { ReactElement, useState } from "react";
|
||||||
|
import TabTitle from "./TabTitle";
|
||||||
|
import styles from '../style/BasicTabs.module.sass'
|
||||||
|
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
children: ReactElement[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const Tabs: React.FC<Props> = ({ children }) => {
|
||||||
|
const [selectedTab, setSelectedTab] = useState(0);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ul style={{"display":"flex","justifyContent":"space-between", listStyleType:"none"}}>
|
||||||
|
{children.map((item, index) => {
|
||||||
|
<TabTitle
|
||||||
|
key={index}
|
||||||
|
title={item.props.title}
|
||||||
|
index={index}
|
||||||
|
setSelectedTab={setSelectedTab}
|
||||||
|
/>
|
||||||
|
{<span style={{
|
||||||
|
cursor: "unset",
|
||||||
|
height: "20px",
|
||||||
|
margin: "0 20px",
|
||||||
|
borderRight: "1px solid #303f9f",
|
||||||
|
verticalAlign: "middle"
|
||||||
|
}}></span>}
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
{children[selectedTab]}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Tabs
|
11
ui/src/components/UI/BasicTab/Tab.tsx
Normal file
11
ui/src/components/UI/BasicTab/Tab.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const Tab: React.FC<Props> = ({ children }) => {
|
||||||
|
return <div >{children}</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Tab
|
29
ui/src/components/UI/BasicTab/TabTitle.tsx
Normal file
29
ui/src/components/UI/BasicTab/TabTitle.tsx
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import React, { useCallback } from "react"
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
title: string
|
||||||
|
index: number
|
||||||
|
setSelectedTab: (index: number) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const TabTitle: React.FC<Props> = ({ title, setSelectedTab, index }) => {
|
||||||
|
|
||||||
|
const onClick = useCallback(() => {
|
||||||
|
setSelectedTab(index)
|
||||||
|
}, [setSelectedTab, index])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li style={{color: "rgb(32,92,245" ,cursor:"pointer"}}>
|
||||||
|
<div onClick={onClick}>{title}</div>
|
||||||
|
<span style={{
|
||||||
|
cursor: "unset",
|
||||||
|
height: "20px",
|
||||||
|
margin: "0 20px",
|
||||||
|
borderRight: "1px solid #303f9f",
|
||||||
|
verticalAlign: "middle"
|
||||||
|
}}></span>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TabTitle
|
33
ui/src/components/UI/style/BasicTabs.module.sass
Normal file
33
ui/src/components/UI/style/BasicTabs.module.sass
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@import '../../../variables.module'
|
||||||
|
|
||||||
|
.root
|
||||||
|
height: 40%
|
||||||
|
paddingTop: 15px
|
||||||
|
|
||||||
|
.tab
|
||||||
|
display: 'inline-block'
|
||||||
|
textTransform: 'uppercase'
|
||||||
|
color: $blue-color
|
||||||
|
cursor: 'pointer'
|
||||||
|
|
||||||
|
.tabsAlignLeft
|
||||||
|
textAlign: 'left'
|
||||||
|
|
||||||
|
.active
|
||||||
|
color: $font-color
|
||||||
|
cursor: 'unset'
|
||||||
|
borderBottom: "2px solid " + $font-color
|
||||||
|
paddingBottom: 6
|
||||||
|
|
||||||
|
&.dark
|
||||||
|
|
||||||
|
.disabled
|
||||||
|
|
||||||
|
.highlight
|
||||||
|
|
||||||
|
.separator
|
||||||
|
borderRight: "1px solid " + 'black'
|
||||||
|
height: 20
|
||||||
|
verticalAlign: 'middle'
|
||||||
|
margin: '0 20px'
|
||||||
|
cursor: 'unset'
|
Reference in New Issue
Block a user