From 7cb790bd386da6f1847292d53b799d776bc20ac2 Mon Sep 17 00:00:00 2001 From: Osmose Date: Sat, 11 Jul 2020 11:38:46 -0700 Subject: [PATCH 1/2] Add clock and info icons. --- lib/icon.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/icon.js b/lib/icon.js index 76d468c..79f2d3c 100644 --- a/lib/icon.js +++ b/lib/icon.js @@ -63,6 +63,12 @@ const svgs = { chevronLeft: (props) => , chevronRight: (props) => , chevronUp: (props) => , + clock: (props) => ( + + + + + ), collapse: (props) => ( @@ -103,6 +109,11 @@ const svgs = { /> ), + info: (props) => ( + + + + ), octocat: (props) => ( ), - x: (props) => ( - - - - ), textLightningBolt: (props) => ( ), + x: (props) => ( + + + + ), }; /* eslint-enable react/display-name */ From fe7f9c9643f48efad3de9d9135d7074f3799c609 Mon Sep 17 00:00:00 2001 From: Osmose Date: Sat, 11 Jul 2020 08:57:47 -0700 Subject: [PATCH 2/2] Position tooltip arrow correctly for multi-line tooltips on top. When the height of the tooltip is larger than one line of text, the top-based positioning of the tooltip arrow doesn't reach the bottom of the tooltip box anymore. By positioning the arrow using `bottom`, it can be locked to the bottom of the box regardless of its height. --- lib/tooltip.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tooltip.js b/lib/tooltip.js index 9aa8320..909d9af 100644 --- a/lib/tooltip.js +++ b/lib/tooltip.js @@ -83,7 +83,7 @@ const TooltipBase = styled.div` border-bottom-color: transparent; margin-top: -6px; transform: translateX(-50%) translateY(100%); - top: 85%; + bottom: 0; } `} ${({ left }) => @@ -397,7 +397,7 @@ export const StoryTooltipContainer = () => { /> Top right persistent tooltip} tooltip="Click me" type="info" /> - + `} @@ -432,6 +432,7 @@ export const StoryTooltipContainer = () => { Default aligned tooltip} tooltip="Such center!" type="info" /> Right tooltip} tooltip="Important info!" type="info" /> Top tooltip} tooltip="Click me" type="info" /> + Multi-line tooltip} tooltip={'Multi\nline\ntooltip'} type="info" /> Top right persistent tooltip} tooltip="Click me" type="info" /> );