|
1 |
| -import PropTypes from 'prop-types'; |
2 | 1 | import React from 'react';
|
| 2 | +import PropTypes from 'prop-types'; |
3 | 3 | import { Link } from 'react-router';
|
| 4 | +import styled from 'styled-components'; |
| 5 | +import { remSize, prop, common } from '../theme'; |
4 | 6 |
|
5 | 7 |
|
6 | 8 | // <ul className="nav__dropdown">
|
@@ -41,14 +43,112 @@ import { Link } from 'react-router';
|
41 | 43 |
|
42 | 44 | // 'nav__item--open'
|
43 | 45 |
|
| 46 | +// %dropdown-open { |
| 47 | +// @include themify() { |
| 48 | +// background-color: map-get($theme-map, 'modal-background-color'); |
| 49 | +// border: 1px solid map-get($theme-map, 'modal-border-color'); |
| 50 | +// box-shadow: 0 0 18px 0 getThemifyVariable('shadow-color'); |
| 51 | +// color: getThemifyVariable('primary-text-color'); |
| 52 | +// } |
| 53 | +// text-align: left; |
| 54 | +// width: #{180 / $base-font-size}rem; |
| 55 | +// display: flex; |
| 56 | +// position: absolute; |
| 57 | +// flex-direction: column; |
| 58 | +// top: 95%; |
| 59 | +// height: auto; |
| 60 | +// z-index: 9999; |
| 61 | +// border-radius: #{6 / $base-font-size}rem; |
| 62 | +// ------------- |
| 63 | +// & li:first-child { |
| 64 | +// border-radius: #{5 / $base-font-size}rem #{5 / $base-font-size}rem 0 0; |
| 65 | +// } |
| 66 | +// & li:last-child { |
| 67 | +// border-radius: 0 0 #{5 / $base-font-size}rem #{5 / $base-font-size}rem; |
| 68 | +// } |
| 69 | +// & li { |
| 70 | +// & button, |
| 71 | +// & a { |
| 72 | +// @include themify() { |
| 73 | +// color: getThemifyVariable('primary-text-color'); |
| 74 | +// } |
| 75 | +// width: 100%; |
| 76 | +// text-align: left; |
| 77 | +// padding: #{8 / $base-font-size}rem #{16 / $base-font-size}rem; |
| 78 | +// } |
| 79 | +// height: #{35 / $base-font-size}rem; |
| 80 | +// cursor: pointer; |
| 81 | +// display: flex; |
| 82 | +// align-items: center; |
| 83 | +// } |
| 84 | +// & li:hover { |
| 85 | +// @include themify() { |
| 86 | +// background-color: getThemifyVariable('button-background-hover-color'); |
| 87 | +// color: getThemifyVariable('button-hover-color') |
| 88 | +// } |
| 89 | +// & button, & a { |
| 90 | +// @include themify() { |
| 91 | +// color: getThemifyVariable('button-hover-color'); |
| 92 | +// } |
| 93 | +// } |
| 94 | +// } |
| 95 | +// } |
| 96 | + |
| 97 | +// %dropdown-open-left { |
| 98 | +// @extend %dropdown-open; |
| 99 | +// left: 0; |
| 100 | +// } |
| 101 | + |
| 102 | +// %dropdown-open-right { |
| 103 | +// @extend %dropdown-open; |
| 104 | +// right: 0; |
| 105 | +// } |
| 106 | + |
| 107 | + |
| 108 | +const DropdownWrapper = styled.div` |
| 109 | + background-color: ${prop('Modal.background')}; |
| 110 | + border: 1px solid ${prop('Modal.border')}; |
| 111 | + box-shadow: 0 0 18px 0 ${common.shadowColor}; |
| 112 | + color: ${prop('primaryTextColor')}; |
| 113 | +
|
| 114 | + text-align: left; |
| 115 | + width: ${remSize(180)}; |
| 116 | + display: flex; |
| 117 | + position: absolute; |
| 118 | + flex-direction: column; |
| 119 | + top: 95%; |
| 120 | + height: auto; |
| 121 | + z-index: 9999; |
| 122 | + border-radius: ${remSize(6)}; |
| 123 | +`; |
| 124 | + |
| 125 | + |
| 126 | +// @include themify() { |
| 127 | +// background-color: map-get($theme-map, 'modal-background-color'); |
| 128 | +// border: 1px solid map-get($theme-map, 'modal-border-color'); |
| 129 | +// box-shadow: 0 0 18px 0 getThemifyVariable('shadow-color'); |
| 130 | +// color: getThemifyVariable('primary-text-color'); |
| 131 | +// } |
| 132 | + |
| 133 | + |
44 | 134 | const Dropdown = ({ items }) => (
|
45 |
| - <ul className="nav__dropdown"> |
46 |
| - {items && items.map(item => ( |
47 |
| - <li className="nav__dropdown-item"> |
48 |
| - </li> |
49 |
| - )) |
50 |
| - } |
51 |
| - </ul> |
| 135 | + <DropdownWrapper> |
| 136 | + <h1>space</h1> |
| 137 | + <h1>space</h1> |
| 138 | + <h1>space</h1> |
| 139 | + <h1>space</h1> |
| 140 | + {/* className="nav__items-left" */} |
| 141 | + <ul className="nav__items-left nav__dropdown nav__item nav__item--open"> |
| 142 | + <h1 className="nav__dropdown-item">hello</h1> |
| 143 | + <h1 className="nav__dropdown-item">hello</h1> |
| 144 | + {items && items.map(({ title }) => ( |
| 145 | + <li className="nav__dropdown-item" key={`nav-${title && title.toLowerCase()}`}> |
| 146 | + <h1>space</h1> |
| 147 | + </li> |
| 148 | + )) |
| 149 | + } |
| 150 | + </ul> |
| 151 | + </DropdownWrapper> |
52 | 152 | );
|
53 | 153 |
|
54 | 154 | Dropdown.propTypes = {
|
|
0 commit comments