Skip to content

Commit

Permalink
Remove padding prop from Link
Browse files Browse the repository at this point in the history
  • Loading branch information
moroshko committed Sep 16, 2020
1 parent 364058d commit 5a53e18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
9 changes: 1 addition & 8 deletions src/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ import useTheme from "../hooks/useTheme";
import useBackground, { mapResponsiveValues } from "../hooks/useBackground";
import {
responsiveMarginType,
responsivePaddingType,
responsiveWidthType,
} from "../hooks/useResponsiveProp";
import useResponsivePropsCSS from "../hooks/useResponsivePropsCSS";
import {
responsiveMargin,
responsivePadding,
responsiveSize,
} from "../utils/css";
import { responsiveMargin, responsiveSize } from "../utils/css";
import { mergeProps } from "../utils/component";
import { formatArray } from "../utils/array";
import { hasOwnProperty } from "../utils/core";
Expand Down Expand Up @@ -148,7 +143,6 @@ function Link(props) {
__internal__active,
});
},
padding: responsivePadding,
});

const { InternalLink, isLinkInternal } = useContext(LinkContext);
Expand Down Expand Up @@ -206,7 +200,6 @@ function Link(props) {

Link.propTypes = {
...responsiveMarginType,
...responsivePaddingType,
...responsiveWidthType,
appearance: (props) => {
if (props.appearance === undefined) {
Expand Down
14 changes: 0 additions & 14 deletions src/components/Link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,6 @@ describe("Link", () => {
});
});

it("with padding", () => {
render(
<Link href="/terms" newTab={false} padding="3 6">
Terms and Conditions
</Link>
);

const span = screen.getByText("Terms and Conditions");

expect(span).toHaveStyle({
padding: "12px 24px",
});
});

it("with width", () => {
render(
<Link
Expand Down
18 changes: 15 additions & 3 deletions website/src/layouts/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SEO from "../components/SEO";
import Sidebar from "../components/Sidebar";
import ComponentStatusIndicator from "../components/ComponentStatusIndicator";
import Splitbee from "../components/Splitbee";
import { BasisProvider, Container, Text, Link } from "basis";
import { BasisProvider, Container, Text } from "basis";
import theme from "../themes/website";
import { getTabsUrls } from "../utils/url";
import "typeface-montserrat";
Expand Down Expand Up @@ -116,9 +116,21 @@ function Page({ pageContext, children }) {
}}
key={name}
>
<Link href={href} newTab={false} padding="2 6">
<GatsbyLink
css={{
display: "flex",
alignItems: "center",
boxSizing: "border-box",
width: "100%",
padding: `${theme.space[2]} ${theme.space[6]}`,
color: isCurrent
? theme.colors.black
: theme.colors.grey.t75,
}}
to={href}
>
{name}
</Link>
</GatsbyLink>
</li>
))}
</ul>
Expand Down

1 comment on commit 5a53e18

@vercel
Copy link

@vercel vercel bot commented on 5a53e18 Sep 16, 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.