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

<Tooltip />の矢印の位置を変える #195

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

youchann
Copy link
Contributor

@youchann youchann added the enhancement New feature or request label Oct 19, 2020
@youchann youchann self-assigned this Oct 19, 2020
@youchann
Copy link
Contributor Author

ひとまずデザイナー確認

@youchann
Copy link
Contributor Author

おーけー

Comment on lines +159 to +169
placement={state?.placement}
// MEMO: The following placements use popperJS default styles
style={
[
"auto",
"auto-start",
"auto-end",
"top",
"bottom",
"right",
"left",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

上記のpositionの時は今まで通り

Comment on lines +4 to +22
const getArrowPosition = (
theme: DefaultTheme,
placements: PopperJS.Placement[],
currentPlacement?: PopperJS.Placement,
) =>
currentPlacement && placements.includes(currentPlacement)
? `${theme.spacing * 1.5}px`
: "auto";

export const Arrow = styled.div<{ placement?: PopperJS.Placement }>`
position: absolute;
top: ${({ theme, placement }) =>
getArrowPosition(theme, ["left-start", "right-start"], placement)};
bottom: ${({ theme, placement }) =>
getArrowPosition(theme, ["left-end", "right-end"], placement)};
left: ${({ theme, placement }) =>
getArrowPosition(theme, ["top-start", "bottom-start"], placement)};
right: ${({ theme, placement }) =>
getArrowPosition(theme, ["top-end", "bottom-end"], placement)};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

そうでないときは独自で定義

Copy link
Contributor

@maktak1995 maktak1995 left a comment

Choose a reason for hiding this comment

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

LGTM!

@youchann youchann merged commit 4d5ed5a into master Oct 19, 2020
@youchann youchann deleted the modify-tooltip-arrow-position branch October 19, 2020 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants