Skip to content

Commit

Permalink
Merge pull request #199 from mikecao/dev
Browse files Browse the repository at this point in the history
v0.48.0
  • Loading branch information
mikecao authored Sep 22, 2020
2 parents 2564941 + 127de9c commit 418a24d
Show file tree
Hide file tree
Showing 64 changed files with 861 additions and 452 deletions.
3 changes: 2 additions & 1 deletion assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/moon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/sun.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion components/WebsiteDetails.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

.content {
min-height: 600px;
padding: 20px 0;
}

.backButton {
Expand All @@ -30,7 +31,7 @@

.row > [class*='col-'] {
border-left: 1px solid var(--gray300);
padding: 0 20px;
padding: 20px;
}

.row > [class*='col-']:first-child {
Expand Down
7 changes: 4 additions & 3 deletions components/common/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
justify-content: center;
align-items: center;
font-size: var(--font-size-normal);
color: var(--gray900);
background: var(--gray100);
padding: 8px 16px;
border-radius: 4px;
Expand All @@ -18,7 +19,7 @@
}

.button:active {
color: initial;
color: var(--gray900);
}

.large {
Expand Down Expand Up @@ -56,11 +57,11 @@
}

.light {
background: var(--gray50);
background: transparent;
}

.light:hover {
background: var(--gray75);
background: inherit;
}

.button:disabled {
Expand Down
4 changes: 3 additions & 1 deletion components/common/ButtonGroup.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

.group .button {
border-radius: 0;
color: var(--gray800);
background: var(--gray50);
border-left: 1px solid var(--gray500);
padding: 4px 8px;
Expand All @@ -24,6 +25,7 @@
margin: 0;
}

.selected {
.group .button.selected {
color: var(--gray900);
font-weight: 600;
}
8 changes: 7 additions & 1 deletion components/common/Calendar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
text-align: center;
vertical-align: center;
height: 40px;
min-width: 40px;
width: 40px;
border-radius: 5px;
border: 1px solid transparent;
}
Expand Down Expand Up @@ -103,3 +103,9 @@
.icon {
margin-left: 10px;
}

@media only screen and (max-width: 992px) {
.calendar table {
max-width: calc(100vw - 30px);
}
}
9 changes: 8 additions & 1 deletion components/common/DropDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function DropDown({
}) {
const [showMenu, setShowMenu] = useState(false);
const ref = useRef();
const selectedOption = options.find(e => e.value === value);

function handleShowMenu() {
setShowMenu(state => !state);
Expand All @@ -40,7 +41,13 @@ export default function DropDown({
<Icon icon={<Chevron />} className={styles.icon} size="small" />
</div>
{showMenu && (
<Menu className={menuClassName} options={options} onSelect={handleSelect} float="bottom" />
<Menu
className={menuClassName}
options={options}
selectedOption={selectedOption}
onSelect={handleSelect}
float="bottom"
/>
)}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion components/common/Dropdown.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
}

.icon {
padding-left: 10px;
padding-left: 20px;
}
64 changes: 0 additions & 64 deletions components/common/LanguageButton.js

This file was deleted.

9 changes: 0 additions & 9 deletions components/common/LanguageButton.module.css

This file was deleted.

4 changes: 2 additions & 2 deletions components/common/Link.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ a.link,
a.link:active,
a.link:visited {
position: relative;
color: #2c2c2c;
color: var(--gray900);
text-decoration: none;
}

Expand All @@ -12,7 +12,7 @@ a.link:before {
bottom: -2px;
width: 0;
height: 2px;
background: #2680eb;
background: var(--primary400);
opacity: 0.5;
transition: width 100ms;
}
Expand Down
3 changes: 2 additions & 1 deletion components/common/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default function Menu({
<div
key={value}
className={classNames(styles.option, optionClassName, customClassName, {
[selectedClassName]: selectedOption === value,
[selectedClassName]: selectedOption === option,
[styles.selected]: selectedOption === option,
[styles.divider]: divider,
})}
onClick={e => onSelect(value, e)}
Expand Down
8 changes: 6 additions & 2 deletions components/common/Menu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
.option {
font-size: var(--font-size-small);
font-weight: normal;
background: #fff;
background: var(--gray50);
padding: 4px 16px;
cursor: pointer;
white-space: nowrap;
}

.option:hover {
background: #f5f5f5;
background: var(--gray100);
}

.float {
Expand Down Expand Up @@ -44,3 +44,7 @@
.divider {
border-top: 1px solid var(--gray300);
}

.selected {
font-weight: 600;
}
58 changes: 58 additions & 0 deletions components/common/MenuButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { useState, useRef } from 'react';
import classNames from 'classnames';
import Menu from 'components/common/Menu';
import Button from 'components/common/Button';
import useDocumentClick from 'hooks/useDocumentClick';
import styles from './MenuButton.module.css';

export default function MenuButton({
icon,
value,
options,
menuPosition = 'bottom',
menuAlign = 'right',
onSelect,
renderValue,
}) {
const [showMenu, setShowMenu] = useState(false);
const ref = useRef();
const selectedOption = options.find(e => e.value === value);

function handleSelect(value) {
onSelect(value);
setShowMenu(false);
}

function toggleMenu() {
setShowMenu(state => !state);
}

useDocumentClick(e => {
if (!ref.current.contains(e.target)) {
setShowMenu(false);
}
});

return (
<div className={styles.container} ref={ref}>
<Button
icon={icon}
className={classNames(styles.button, { [styles.open]: showMenu })}
onClick={toggleMenu}
variant="light"
>
<div className={styles.text}>{renderValue ? renderValue(selectedOption) : value}</div>
</Button>
{showMenu && (
<Menu
className={styles.menu}
options={options}
selectedOption={selectedOption}
onSelect={handleSelect}
float={menuPosition}
align={menuAlign}
/>
)}
</div>
);
}
24 changes: 24 additions & 0 deletions components/common/MenuButton.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.container {
display: flex;
position: relative;
cursor: pointer;
}

.button {
border: 1px solid transparent;
border-radius: 4px;
}

.menu {
z-index: 100;
}

.text {
font-size: var(--font-size-small);
}

.open,
.open:hover {
background: var(--gray50);
border: 1px solid var(--gray500);
}
4 changes: 2 additions & 2 deletions components/common/Modal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
right: 0;
bottom: 0;
margin: auto;
background: var(--gray900);
opacity: 0.1;
background: #000;
opacity: 0.5;
}

.content {
Expand Down
2 changes: 2 additions & 0 deletions components/common/NavMenu.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.menu {
color: var(--gray800);
border: 1px solid var(--gray500);
border-radius: 4px;
overflow: hidden;
Expand All @@ -16,5 +17,6 @@
}

.selected {
color: var(--gray900);
font-weight: 600;
}
2 changes: 1 addition & 1 deletion components/common/Toast.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
justify-content: space-between;
align-items: center;
padding: 8px 16px;
color: var(--gray50);
color: var(--msgColor);
background: var(--green400);
margin: auto;
z-index: 2;
Expand Down
22 changes: 0 additions & 22 deletions components/common/UserButton.module.css

This file was deleted.

Loading

1 comment on commit 418a24d

@vercel
Copy link

@vercel vercel bot commented on 418a24d Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.