浏览代码

Remoe nested CSS rules and element selectors in favor of class selectors

Konstantin Tarkus 9 年之前
父节点
当前提交
332b8b1c42
共有 2 个文件被更改,包括 24 次插入20 次删除
  1. 6 2
      components/Navigation/Navigation.js
  2. 18 18
      components/Navigation/Navigation.scss

+ 6 - 2
components/Navigation/Navigation.js

@@ -13,8 +13,12 @@ export default class extends Component {
   render() {
     return (
       <ul className="Navigation" role="menu">
-        <li><a href="/" onClick={Link.handleClick}>Home</a></li>
-        <li><a href="/about" onClick={Link.handleClick}>About</a></li>
+        <li className="Navigation-item">
+          <a className="Navigation-link" href="/" onClick={Link.handleClick}>Home</a>
+        </li>
+        <li className="Navigation-item">
+          <a className="Navigation-link" href="/about" onClick={Link.handleClick}>About</a>
+        </li>
       </ul>
     );
   }

+ 18 - 18
components/Navigation/Navigation.scss

@@ -12,29 +12,29 @@
   margin: 2em 0 5em 0;
   list-style: none;
   justify-content: flex-end;
+}
 
-  li {
-    padding: 0 2em;
+.Navigation-item {
+  padding: 0 2em;
+}
 
-    a {
-      padding: 0.5em 1em;
-      color: $brand-color;
-      text-decoration: none;
-      text-transform: uppercase;
-      cursor: pointer;
+.Navigation-link {
+  padding: 0.5em 1em;
+  color: $brand-color;
+  text-decoration: none;
+  text-transform: uppercase;
+  cursor: pointer;
 
-      &:hover {
-        border-bottom: 3px solid $brand-color;
-        color: $text-color;
-      }
+  &:hover {
+    border-bottom: 3px solid $brand-color;
+    color: $text-color;
+  }
 
-      &:visited {
-        color: $brand-color;
+  &:visited {
+    color: $brand-color;
 
-        &:hover {
-          color: $text-color;
-        }
-      }
+    &:hover {
+      color: $text-color;
     }
   }
 }