Fix tooltip width

This commit is contained in:
Ildar Kamalov 2018-10-08 18:55:30 +03:00
parent 6de0871f2c
commit 5718f55b9a
5 changed files with 22 additions and 11 deletions

View File

@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
import Card from '../ui/Card'; import Card from '../ui/Card';
import Tooltip from '../ui/Tooltip'; import Tooltip from '../ui/Tooltip';
const tooltipType = 'tooltip-custom--narrow';
const Counters = props => ( const Counters = props => (
<Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> <Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<table className="table card-table"> <table className="table card-table">
@ -11,7 +13,7 @@ const Counters = props => (
<tr> <tr>
<td> <td>
DNS Queries DNS Queries
<Tooltip text="A number of DNS quieries processed in the last 24 hours" /> <Tooltip text="A number of DNS quieries processed in the last 24 hours" type={tooltipType} />
</td> </td>
<td className="text-right"> <td className="text-right">
<span className="text-muted"> <span className="text-muted">
@ -22,7 +24,7 @@ const Counters = props => (
<tr> <tr>
<td> <td>
Blocked by filters Blocked by filters
<Tooltip text="A number of DNS requests blocked by filters" /> <Tooltip text="A number of DNS requests blocked by filters" type={tooltipType} />
</td> </td>
<td className="text-right"> <td className="text-right">
<span className="text-muted"> <span className="text-muted">
@ -33,7 +35,7 @@ const Counters = props => (
<tr> <tr>
<td> <td>
Blocked malware/phishing Blocked malware/phishing
<Tooltip text="A number of DNS requests blocked" /> <Tooltip text="A number of DNS requests blocked" type={tooltipType} />
</td> </td>
<td className="text-right"> <td className="text-right">
<span className="text-muted"> <span className="text-muted">
@ -44,7 +46,7 @@ const Counters = props => (
<tr> <tr>
<td> <td>
Blocked adult websites Blocked adult websites
<Tooltip text="A number of adult websites blocked" /> <Tooltip text="A number of adult websites blocked" type={tooltipType} />
</td> </td>
<td className="text-right"> <td className="text-right">
<span className="text-muted"> <span className="text-muted">
@ -55,7 +57,7 @@ const Counters = props => (
<tr> <tr>
<td> <td>
Enforced safe search Enforced safe search
<Tooltip text="A number of DNS requests to search engines for which Safe Search was enforced" /> <Tooltip text="A number of DNS requests to search engines for which Safe Search was enforced" type={tooltipType} />
</td> </td>
<td className="text-right"> <td className="text-right">
<span className="text-muted"> <span className="text-muted">
@ -66,7 +68,7 @@ const Counters = props => (
<tr> <tr>
<td> <td>
Average processing time Average processing time
<Tooltip text="Average time in milliseconds on processing a DNS request" /> <Tooltip text="Average time in milliseconds on processing a DNS request" type={tooltipType} />
</td> </td>
<td className="text-right"> <td className="text-right">
<span className="text-muted"> <span className="text-muted">

View File

@ -14,3 +14,7 @@
.form-control--textarea { .form-control--textarea {
min-height: 110px; min-height: 110px;
} }
.form-control--textarea-large {
min-height: 240px;
}

View File

@ -40,11 +40,11 @@
background-size: 14px; background-size: 14px;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url('data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg=='); background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
} }
.card-refresh:hover, .card-refresh:hover,
.card-refresh:not(:disabled):not(.disabled):active, .card-refresh:not(:disabled):not(.disabled):active,
.card-refresh:focus:active { .card-refresh:focus:active {
background-image: url('data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg=='); background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
} }

View File

@ -17,14 +17,14 @@
display: block; display: block;
position: absolute; position: absolute;
bottom: calc(100% + 12px); bottom: calc(100% + 12px);
left: calc(50% - 103px); left: 50%;
width: 206px;
padding: 10px 15px; padding: 10px 15px;
font-size: 0.85rem; font-size: 0.85rem;
text-align: center; text-align: center;
color: #fff; color: #fff;
background-color: #585965; background-color: #585965;
border-radius: 3px; border-radius: 3px;
transform: translateX(-50%);
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
} }
@ -48,3 +48,7 @@
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.tooltip-custom--narrow:before {
width: 206px;
}

View File

@ -4,11 +4,12 @@ import PropTypes from 'prop-types';
import './Tooltip.css'; import './Tooltip.css';
const Tooltip = props => ( const Tooltip = props => (
<div data-tooltip={props.text} className="tooltip-custom"></div> <div data-tooltip={props.text} className={`tooltip-custom ${props.type}`}></div>
); );
Tooltip.propTypes = { Tooltip.propTypes = {
text: PropTypes.string.isRequired, text: PropTypes.string.isRequired,
type: PropTypes.string,
}; };
export default Tooltip; export default Tooltip;