Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fallback react to 16.8-alpha.0 #49

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"styled-system": "^3.2.1"
},
"peerDependencies": {
"react": ">=16.7.0-alpha.2",
"react-dom": ">=16.7.0-alpha.2",
"react": "16.8.0-alpha.0",
"react-dom": "16.8.0-alpha.0",
"react-icons": ">=3.2.0",
"styled-components": ">=4.1.0"
},
Expand Down Expand Up @@ -120,8 +120,8 @@
"lint-staged": "^8.1.0",
"prettier": "^1.16.1",
"prettier-package-json": "^2.0.1",
"react": "^16.8.0-alpha.1",
"react-dom": "^16.8.0-alpha.1",
"react": "^16.8.0-alpha.0",
"react-dom": "16.8.0-alpha.0",
"react-icons": "^3.3.0",
"react-testing-library": "^5.4.4",
"rollup": "^1.1.2",
Expand Down
3 changes: 2 additions & 1 deletion src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
forwardRef,
isValidElement,
useEffect,
useImperativeMethods,
useRef,
} from 'react';
import styled, { css } from 'styled-components';
Expand Down Expand Up @@ -203,7 +204,7 @@ const Input: FunctionComponent<IInputProps> = forwardRef(
const inputRef = useRef<any>(null);

// FIXME: wait for upstream: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/32144
(React as any).useImperativeHandle(ref, () => ({
useImperativeMethods(ref, () => ({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

超尷尬

focus: () => inputRef.current.focus(),
blur: () => inputRef.current.blur(),
}));
Expand Down
1 change: 0 additions & 1 deletion src/NewMenu/SubMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const SubMenu: FunctionComponent<ISubMenuProps> = ({
light
placement="right"
content={title}
minWidth="60px"
visible={!contentVisible && tooltipVisible}
onVisibleChange={visible => {
if (!contentVisible) {
Expand Down
26 changes: 9 additions & 17 deletions src/NewMenu/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css } from 'styled-components';
import styled from 'styled-components';
import { animated } from 'react-spring/hooks.cjs';

import tag from 'utils/CleanTag';
Expand All @@ -11,6 +11,7 @@ const SubMenuWrapper = styled(tag.div)`
flex-direction: column;
height: 100%;
background-color: ${p => p.theme.colors.primary};
box-shadow: 4px 0 6px 0 rgba(94, 94, 94, 0.5);
`;

export const AnimatedSubMenuWrapper = animated(SubMenuWrapper);
Expand Down Expand Up @@ -44,17 +45,13 @@ export const StyledSubMenu = styled(tag.div)<IStyledSubMenuProps>`
box-sizing: border-box;
width: 48px;
height: 48px;
border-left: 3px solid transparent;
background-color: ${p => p.theme.colors.primaryDark};
border-right: 3px solid transparent;
border-left: 3px solid
${p => (p.active ? p.theme.colors.secondaryLight : 'transparent')};
background-color: ${p =>
p.active ? p.theme.colors.primary : p.theme.colors.primaryDark};
color: white;
${p =>
p.active &&
css`
background-color: ${p.theme.colors.primary};
border-color: ${p.theme.colors.secondaryLight};
`}
${p => p.theme.transition};
`;

Expand All @@ -68,17 +65,12 @@ export const StyledMenuItem = styled(tag.div)<IStyledMenuItemProps>`
width: 100%;
height: 48px;
padding: 0 ${p => p.theme.space[3]};
color: ${p => p.theme.colors.light};
color: ${p =>
p.active ? p.theme.colors.secondaryLight : p.theme.colors.light};
font-size: ${p => p.theme.fontSizes.base};
cursor: pointer;
&:hover {
background-color: ${p => p.theme.colors.primaryLight};
}
${({ active }) =>
active &&
css`
color: ${p => p.theme.colors.secondaryLight};
`};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,12 @@ exports[`Popconfirm should render correctly 1`] = `
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
color: #ffffff;
font-size: 0.875rem;
white-space: nowrap;
opacity: 0.8;
padding: 0.25rem;
min-width: 120px;
padding-left: 0.5rem;
padding-right: 0.5rem;
padding-top: 0.25rem;
padding-bottom: 0.25rem;
border-radius: 0.25rem;
text-align: center;
padding: 0;
Expand Down
9 changes: 3 additions & 6 deletions src/Tooltip/BaseTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import styled, { css } from 'styled-components';
import {
BorderRadiusProps,
ColorProps,
MinWidthProps,
SpaceProps,
TextAlignProps,
borderRadius,
color,
minWidth,
space,
textAlign,
} from 'styled-system';
Expand All @@ -17,7 +15,6 @@ import tag from 'utils/CleanTag';
import { Placement } from '../Trigger/type';

export type TooltipContentProps = SpaceProps &
MinWidthProps &
ColorProps &
BorderRadiusProps &
TextAlignProps & {
Expand All @@ -34,6 +31,7 @@ export const TooltipContent = styled(tag.div)<TooltipContentProps>`
color: ${({ light, theme: { colors } }) =>
light ? colors.gray700 : colors.light};
font-size: ${p => p.theme.fontSizes.sm};
white-space: nowrap;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

不換行了


${({ light }) =>
!light &&
Expand All @@ -42,15 +40,14 @@ export const TooltipContent = styled(tag.div)<TooltipContentProps>`
`};

${space};
${minWidth};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

這個 breaking 但影響應該不大

${color};
${borderRadius};
${textAlign};
`;

TooltipContent.defaultProps = {
minWidth: 120,
p: 1,
py: 1,
px: 2,
textAlign: 'center',
borderRadius: 'base',
};
Expand Down
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9996,25 +9996,25 @@ react-docgen@^3.0.0-rc.1:
node-dir "^0.1.10"
recast "^0.16.0"

react-dom@^16.7.0:
version "16.7.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.7.0.tgz#a17b2a7ca89ee7390bc1ed5eb81783c7461748b8"
integrity sha512-D0Ufv1ExCAmF38P2Uh1lwpminZFRXEINJe53zRAbm4KPwSyd6DY/uDoS0Blj9jvPpn1+wivKpZYc8aAAN/nAkg==
react-dom@16.8.0-alpha.0:
version "16.8.0-alpha.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.0-alpha.0.tgz#47bbcf42593eab5468b577d3c3f3c27f251a65ef"
integrity sha512-OGfLUXGxtMgqLB1BqnB9flVCvc8VvAnhQYeFr+EUzwiODcD34dPrxtfa7ccK4dwzcPi8HRLSyBcaQi2OvVoUww==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.12.0"
scheduler "^0.13.0-alpha.0"

react-dom@^16.8.0-alpha.1:
version "16.8.0-alpha.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.0-alpha.1.tgz#dab73b8354ba2e498e3127d18e29d4546cea889e"
integrity sha512-tZCUM8BpnwUHJmLnUWP9c3vVZxnCqYotj7s4tx7umojG6BKv745KIBtuPTzt0EI0q50GMLEpmT/CPQ8iA61TwQ==
react-dom@^16.7.0:
version "16.7.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.7.0.tgz#a17b2a7ca89ee7390bc1ed5eb81783c7461748b8"
integrity sha512-D0Ufv1ExCAmF38P2Uh1lwpminZFRXEINJe53zRAbm4KPwSyd6DY/uDoS0Blj9jvPpn1+wivKpZYc8aAAN/nAkg==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.13.0-alpha.1"
scheduler "^0.12.0"

react-dropzone@7.0.1:
version "7.0.1"
Expand Down Expand Up @@ -10229,15 +10229,15 @@ react@>=16.0.0, react@^16.7.0:
prop-types "^15.6.2"
scheduler "^0.12.0"

react@^16.8.0-alpha.1:
version "16.8.0-alpha.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.0-alpha.1.tgz#c2b32689f3b466d3ce85a634dd9035f789d2cd97"
integrity sha512-vLwwnhM2dXrCsiQmcSxF2UdZVV5xsiXjK5Yetmy8dVqngJhQ3aw3YJhZN/YmyonxwdimH40wVqFQfsl4gSu2RA==
react@^16.8.0-alpha.0:
version "16.8.0-alpha.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.0-alpha.0.tgz#8545eb79534cce5ba99ed40085f7f955e8857a19"
integrity sha512-B/nJJkNqV4JAJQ1M0Q38ZvhZ6BoYsjyZq29hbsIIPYayn/0DcYhu7tExpfzdtTC0SnUcA+RnDBTlXTEJ5b9PEg==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.13.0-alpha.1"
scheduler "^0.13.0-alpha.0"

read-pkg-up@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -10950,7 +10950,7 @@ scheduler@^0.12.0:
loose-envify "^1.1.0"
object-assign "^4.1.1"

scheduler@^0.13.0-alpha.1:
scheduler@^0.13.0-alpha.0:
version "0.13.0-alpha.1"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.0-alpha.1.tgz#753977fb4fb35d8cdd559868a11e46b640955556"
integrity sha512-W0sH0848sVuPKg+I18vTYQyzVtA4X1lrVgSeXK6KnOPUltFdJcY5nkbTkjGUeS/E0x+eBsNYfSdhJtGjT95njw==
Expand Down