Преглед изворни кода

Merge pull request #6404 from weseek/imprv/102017-refactor-TagLabels-AuthorInfo-skelton

imprv: 102017 refactor tag labels author info skelton
Yuki Takei пре 3 година
родитељ
комит
488409900c

+ 28 - 2
packages/app/src/components/Navbar/AuthorInfo.module.scss

@@ -1,5 +1,31 @@
+@use '~/styles/bootstrap/init' as bs;
 
 
-.grw-author-info-skelton {
+$author-font-size: 12px;
+$date-font-size: 11px;
+
+.grw-author-info :global {
+  li {
+    font-size: $author-font-size;
+    list-style: none;
+  }
+
+  .text-date {
+    font-size: $date-font-size;
+  }
+
+  .picture {
+    width: 22px;
+    height: 22px;
+    border: 1px solid bs.$gray-300;
+
+    &.picture-xs {
+      width: 14px;
+      height: 14px;
+    }
+  }
+}
+
+.grw-author-info-skelton :global {
   width: 139px;
   width: 139px;
-  height: 32.84px;
+  height: calc((#{$author-font-size} + #{$date-font-size}) * #{bs.$line-height-base});
 }
 }

+ 10 - 32
packages/app/src/components/Navbar/GrowiSubNavigation.module.scss

@@ -88,42 +88,20 @@
       font-size: 16px;
       font-size: 16px;
     }
     }
 
 
-    ul.authors {
-      li {
-        font-size: 12px;
-        list-style: none;
-      }
+    .user-list-popover {
+      max-width: 200px;
 
 
-      .text-date {
-        font-size: 11px;
-      }
+      .user-list-content {
+        direction: rtl;
 
 
-      .picture {
-        width: 22px;
-        height: 22px;
-        border: 1px solid bs.$gray-300;
-
-        &.picture-xs {
-          width: 14px;
-          height: 14px;
+        .liker-user-count,
+        .seen-user-count {
+          font-size: 12px;
+          font-weight: bolder;
         }
         }
       }
       }
-
-      .user-list-popover {
-        max-width: 200px;
-
-        .user-list-content {
-          direction: rtl;
-
-          .liker-user-count,
-          .seen-user-count {
-            font-size: 12px;
-            font-weight: bolder;
-          }
-        }
-        .cls-1 {
-          isolation: isolate;
-        }
+      .cls-1 {
+        isolation: isolate;
       }
       }
     }
     }
   }
   }

+ 1 - 1
packages/app/src/components/Navbar/GrowiSubNavigation.tsx

@@ -103,7 +103,7 @@ export const GrowiSubNavigation = (props: Props): JSX.Element => {
 
 
         {/* Page Authors */}
         {/* Page Authors */}
         { (showPageAuthors && !isCompactMode) && (
         { (showPageAuthors && !isCompactMode) && (
-          <ul className="authors text-nowrap border-left d-none d-lg-block d-edit-none py-2 pl-4 mb-0 ml-3">
+          <ul className={`${AuthorInfoStyles['grw-author-info']} text-nowrap border-left d-none d-lg-block d-edit-none py-2 pl-4 mb-0 ml-3`}>
             <li className="pb-1">
             <li className="pb-1">
               <AuthorInfo user={creator as IUser} date={createdAt} locate="subnav" />
               <AuthorInfo user={creator as IUser} date={createdAt} locate="subnav" />
             </li>
             </li>

+ 1 - 1
packages/app/src/components/Page/RenderTagLabels.tsx

@@ -35,7 +35,7 @@ const RenderTagLabels = React.memo((props: RenderTagLabelsProps) => {
 
 
       <div id="edit-tags-btn-wrapper-for-tooltip">
       <div id="edit-tags-btn-wrapper-for-tooltip">
         <a
         <a
-          className={`btn btn-link btn-edit-tags p-0 text-muted ${isTagsEmpty ? 'no-tags' : ''} ${isGuestUser ? 'disabled' : ''}`}
+          className={`btn btn-link btn-edit-tags p-0 text-muted d-flex ${isTagsEmpty ? 'no-tags' : ''} ${isGuestUser ? 'disabled' : ''}`}
           onClick={openEditorHandler}
           onClick={openEditorHandler}
         >
         >
           { isTagsEmpty && <>{ t('Add tags for this page') }</>}
           { isTagsEmpty && <>{ t('Add tags for this page') }</>}

+ 5 - 2
packages/app/src/components/Page/TagLabels.module.scss

@@ -1,8 +1,10 @@
 @use '~/styles/bootstrap/init' as bs;
 @use '~/styles/bootstrap/init' as bs;
 
 
+$grw-tag-label-font-size: 12px;
+
 .grw-tag-labels :global {
 .grw-tag-labels :global {
   .grw-tag-label {
   .grw-tag-label {
-    font-size: 12px;
+    font-size: $grw-tag-label-font-size;
     font-weight: normal;
     font-weight: normal;
     border-radius: bs.$border-radius;
     border-radius: bs.$border-radius;
   }
   }
@@ -11,5 +13,6 @@
 
 
 .grw-tag-labels-skelton :global {
 .grw-tag-labels-skelton :global {
   width: 137px;
   width: 137px;
-  height: 21.99px;
+  height: calc(#{$grw-tag-label-font-size} + #{bs.$badge-padding-y} * 2);
+  font-size: $grw-tag-label-font-size; // set font-size to use the same em value in bs.$badge-padding-y(https://getbootstrap.jp/docs/5.0/components/badge/#variables)
 }
 }

+ 2 - 2
packages/app/src/components/Page/TagLabels.tsx

@@ -27,7 +27,7 @@ const TagLabels:FC<Props> = (props: Props) => {
 
 
   return (
   return (
     <>
     <>
-      <form className={`${styles['grw-tag-labels']} grw-tag-labels form-inline`}>
+      <div className={`${styles['grw-tag-labels']} grw-tag-labels d-flex align-items-center`}>
         <i className="tag-icon icon-tag mr-2"></i>
         <i className="tag-icon icon-tag mr-2"></i>
         { tags == null
         { tags == null
           ? (
           ? (
@@ -41,7 +41,7 @@ const TagLabels:FC<Props> = (props: Props) => {
             />
             />
           )
           )
         }
         }
-      </form>
+      </div>
 
 
       <TagEditModal
       <TagEditModal
         tags={tags}
         tags={tags}