-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from salino3/custom-tooltip
Custom tooltip
- Loading branch information
Showing
10 changed files
with
156 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -8,7 +8,12 @@ | |
rel="stylesheet" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" | ||
/> | ||
|
||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" | ||
crossorigin="anonymous" | ||
/> | ||
<title>My web React</title> | ||
</head> | ||
<body> | ||
|
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
76 changes: 76 additions & 0 deletions
76
src/pods/home/components/custom-tooltip/custom-tooltip.component.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,76 @@ | ||
import React from "react"; | ||
import "./custom-tooltip.styles.scss"; | ||
|
||
export const CustomTooltip: React.FC = () => { | ||
interface TableData { | ||
id: number; | ||
name: string; | ||
city: string; | ||
email: string; | ||
} | ||
|
||
const mockTableData: TableData[] = [ | ||
{ | ||
id: 1, | ||
name: "Mark", | ||
city: "Berlin", | ||
email: "[email protected]", | ||
}, | ||
{ | ||
id: 2, | ||
name: "Jacob", | ||
city: "Madrid", | ||
email: "[email protected]", | ||
}, | ||
{ | ||
id: 3, | ||
name: "Larry", | ||
city: "London", | ||
email: "[email protected]", | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="rootCustomTooltip"> | ||
<div className="containerTitle"> | ||
<h2>Custom Tooltip</h2> | ||
</div> | ||
<div className="containerTable"> | ||
<table className="table"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Name</th> | ||
<th scope="col">City</th> | ||
<th className="lastThTitle" scope="col"> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{mockTableData && | ||
mockTableData?.length > 0 && | ||
mockTableData.map((item) => ( | ||
<tr className="trTable" key={item?.id}> | ||
<th scope="row">{item?.id}</th> | ||
<th scope="row"> | ||
{item?.name} | ||
<span>{item?.name}</span> | ||
</th> | ||
<th scope="row"> | ||
{item?.city} | ||
|
||
<span>{item?.city}</span> | ||
</th> | ||
<th scope="row"> | ||
{item?.email} | ||
<span>{item?.email}</span> | ||
</th> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
); | ||
}; |
58 changes: 58 additions & 0 deletions
58
src/pods/home/components/custom-tooltip/custom-tooltip.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,58 @@ | ||
.rootCustomTooltip { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 1rem; | ||
margin-top: 0.5rem; | ||
|
||
.containerTable { | ||
.table { | ||
thead th:first-child { | ||
border-radius: 12px 0 0 0 !important; | ||
} | ||
|
||
thead tr, | ||
thead th, | ||
thead td { | ||
background-color: var(--color-four); | ||
color: var(--color-two); | ||
width: 200px; | ||
} | ||
|
||
thead tr th:last-child { | ||
border-radius: 0 12px 0 0 !important; | ||
} | ||
tbody tr, | ||
tbody th, | ||
tbody td { | ||
background-color: var(--color-three); | ||
color: var(--color-two); | ||
width: 200px; | ||
} | ||
.trTable:hover th { | ||
background-color: var(--color-five); | ||
} | ||
|
||
// | ||
th span { | ||
display: none; | ||
} | ||
tbody th { | ||
position: relative; | ||
} | ||
|
||
tbody th:hover span { | ||
position: absolute; | ||
box-shadow: rgba(0, 0, 0, 0.3) 0px 19px 38px, | ||
rgba(0, 0, 0, 0.22) 0px 15px 12px; | ||
display: block; | ||
padding: 0.5rem; | ||
border-radius: 12px; | ||
background-color: var(--color-one); | ||
top: -10px; | ||
right: 10px; | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
export * from "./custom-tooltip.component"; |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./image-rotate"; | ||
export * from "./input-text"; | ||
export * from "./custom-tooltip"; |
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
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
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