From 1a4f8a378fcbc41e3a49fc51d1eb5968703a9155 Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Wed, 31 Mar 2021 21:22:35 +0700 Subject: [PATCH] Add CSS panel for feedback patterns --- client/patterns/modal/Details.tsx | 44 ++- client/patterns/notification/Details.tsx | 12 +- client/patterns/popover-arrow/Details.tsx | 355 ++++++++---------- .../patterns/presence-indicator/Details.tsx | 42 ++- client/patterns/progress-bar/Details.tsx | 46 +-- .../patterns/radial-progress-bar/Details.tsx | 146 +++---- client/patterns/resizable-element/Details.tsx | 244 +++++------- client/patterns/tooltip/Details.tsx | 40 +- client/patterns/validation-icon/Details.tsx | 58 +-- 9 files changed, 467 insertions(+), 520 deletions(-) diff --git a/client/patterns/modal/Details.tsx b/client/patterns/modal/Details.tsx index 8cf4ffd..96e1283 100644 --- a/client/patterns/modal/Details.tsx +++ b/client/patterns/modal/Details.tsx @@ -28,18 +28,9 @@ const Details: React.FC<{}> = () => { +
-
+
... @@ -50,18 +41,33 @@ html={` ... -
+
`} -css={``} +css={` +.container { + /* Border */ + border: 1px solid rgba(0, 0, 0.3); + border-radius: 4px; +} + +.container__header { + display: flex; + justify-content: space-between; + /* Border */ + border-bottom: 1px solid rgba(0, 0, 0.3); +} + +.container__footer { + display: flex; + /* Push the buttons to the right */ + justify-content: flex-end; + /* Border */ + border-top: 1px solid rgba(0, 0, 0.3); +} +`} >
= () => {
+
... @@ -38,7 +35,12 @@ html={` ...
`} -css={``} +css={` +.container { + display: flex; + justify-content: space-between; +} +`} >
= () => {
+ + ... + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+`} +css={` +.container { /* Border */ border: 1px solid rgba(0, 0, 0, 0.3); /* Used to position the arrow */ position: relative; -"> - - ... +} - -
+.container__arrow--tl { + /* Position at the top left corner */ + left: 32px; + top: 0px; - -
+ /* Border */ + border-left: 1px solid rgba(0, 0, 0, 0.3); + border-top: 1px solid rgba(0, 0, 0, 0.3); + transform: translate(-50%, -50%) rotate(45deg); +} - -
+.container__arrow--rt { + /* Position at the right top corner */ + right: 0; + top: 32px; - -
+ /* Border */ + border-right: 1px solid rgba(0, 0, 0, 0.3); + border-top: 1px solid rgba(0, 0, 0, 0.3); + transform: translate(50%, -50%) rotate(45deg); +} - -
+.container__arrow--bl { + /* Position at the bottom left corner */ + bottom: -16px; + left: 32px; - -
+ /* Border */ + border-bottom: 1px solid rgba(0, 0, 0, 0.3); + border-right: 1px solid rgba(0, 0, 0, 0.3); + transform: translate(-50%, -50%) rotate(45deg); +} - -
+.container__arrow--lt { + /* Position at the left top corner */ + left: 0; + top: 32px; - -
+ /* Border */ + border-bottom: 1px solid rgba(0, 0, 0, 0.3); + border-left: 1px solid rgba(0, 0, 0, 0.3); + transform: translate(-50%, -50%) rotate(45deg); +} - -
- - -
- - -
- - -
-
+ /* Border */ + border-bottom: 1px solid rgba(0, 0, 0, 0.3); + border-left: 1px solid rgba(0, 0, 0, 0.3); + transform: translate(-50%, -50%) rotate(45deg); +} `} -css={``} >
= () => {
+
... -
+
`} -css={``} +css={` +.container { + position: relative; +} + +.container__indicator { + /* Shown at the bottom right corner */ + bottom: 0, + position: absolute; + right: 0; + transform: translate(50%, 50%); + + /* Rounded border */ + border-radius: 9999px; + height: 16px; + width: 16px; + + /* Background color */ + background-color: #FF4136; +} +`} >
= () => {
-
+
@@ -54,7 +36,29 @@ html={`
`} -css={``} +css={` +.container { + /* Colors */ + background-color: rgba(0, 0, 0, .1); + + /* Rounded border */ + border-radius: 9999px; +} + +.container__progress { + /* Center the content */ + align-items: center; + display: flex; + justify-content: center; + + /* Colors */ + background-color: #357edd; + color: #fff; + + /* Rounded border */ + border-radius: 9999px; +} +`} >
= () => {
+
-
+
...
-
+
-
+
-
+
`} -css={``} +css={` +.container { + position: relative; +} + +.container__percentages { + /* Center the content */ + align-items: center; + display: flex; + justify-content: center; + + /* Rounded border */ + border: 12px solid rgba(0, 0, 0, 0.3); + border-radius: 9999px; + + /* Size */ + height: 128px; + width: 128px; +} + +.container__curve { + /* Position */ + left: 0; + position: absolute; + top: 0; + + /* Take full size */ + height: 100%; + width: 100%; + + /* If percentages is less than 50 */ + clip: rect(0px, 128px, 128px, 64px); + + /* If percentages is greater than or equals to 50 */ + clip: rect(auto, auto, auto, auto); +} + +.container__half { + /* Take full size */ + height: 100%; + position: absolute; + width: 100%; + + /* + Background color of curve. + The border width should be the same as the area showing the percentages + */ + border: 12px solid rgb(0, 68, 158); + border-radius: 9999px; +} + +.container__half--first { + /* Position */ + clip: rect(0px, 64px, 128px, 0px); + transform: rotate(162deg); /* Number of percentages * 360 / 100 */ +} + +.container__half--second { + /* Position */ + clip: rect(0px, 64px, 128px, 0px); + + /* If percentages is less than 50 */ + transform: rotate(0deg); + + /* If percentages is greater than or equals to 50 */ + transform: rotate(180deg); +} +`} >
= () => {
+ + ... + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+`} +css={` +.container { /* Border */ border: 1px dashed rgba(0, 0, 0, 0.3); /* Used to position the squares */ position: relative; -"> - - ... +} - -
+ /* Positioned at the top left corner */ + left: 0px; + top: 0px; + transform: translate(-50%, -50%); +} - -
+ /* Positioned at the top right corner */ + right: 0px; + top: 0px; + transform: translate(50%, -50%); +} - -
+ /* Positioned at the right bottom corner */ + bottom: 0px; + right: 0px; + transform: translate(50%, 50%); +} - -
+ /* Positioned at the bottom left corner */ + bottom: 0px; + left: 0px; + transform: translate(-50%, 50%); +} - -
- - -
- - -
- - -
-
+ /* Positioned at the middle of left side */ + left: 0px; + top: 50%; + transform: translate(-50%, -50%); +} `} -css={``} >
= () => {
-.p-tooltip { +
+ +
+ ... +
+ + +
+ + + ... +
+`} +css={` +.container { /* Used to position the arrow */ position: relative; } /* Show the arrow and content when hovering the trigger element */ -.p-tooltip:hover .p-tooltip-arrow, -.p-tooltip:hover .p-tooltip-content { +.container:hover .container__arrow, +.container:hover .container__content { opacity: 1; } -.p-tooltip-arrow { +.container__arrow { /* Invisible by default */ opacity: 0; @@ -62,7 +75,7 @@ html={` z-index: 10; } -.p-tooltip-content { +.container__content { /* Invisible by default */ opacity: 0; @@ -79,22 +92,7 @@ html={` /* Displayed on top of other element */ z-index: 10; } - - -
- -
- ... -
- - -
- - - ... -
`} -css={``} >
= () => {
+
- + - + ... - +
`} -css={``} +css={` +.container { + /* Used to position the validation icon */ + position: relative; +} + +.container__input { + /* Border */ + border: 1px solid rgba(0, 0, 0, 0.3); + border-radius: 4px; + + /* Take the full width */ + width: 100%; + + /* Don't overlap the icon */ + padding-right: 24px; +} + +.container__icon { + /* Positioned at the right side */ + position: absolute; + right: 8px; + top: 50%; + transform: translate(0, -50%); + + z-index: 10; +} +`} >