Skip to content

Commit

Permalink
feat(ButtonGroup): migrate to Tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Oct 2, 2023
1 parent 1e67630 commit 2510a42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 121 deletions.
47 changes: 6 additions & 41 deletions packages/orbit-components/src/ButtonGroup/index.tsx
@@ -1,49 +1,14 @@
"use client";

import * as React from "react";
import styled, { css } from "styled-components";

import defaultTheme from "../defaultTheme";
import { borderRadius, rtlSpacing } from "../utils/rtl";
import mq from "../utils/mediaQuery";
import type { Props } from "./types";

const StyledButtonGroup = styled.div`
display: flex;
.orbit-button-primitive {
border-radius: 0;
margin: ${({ theme }) => rtlSpacing(theme.orbit.marginButtonGroup)};
:first-child {
border-radius: ${borderRadius("6px 0 0 6px")};
}
:last-child {
border-radius: ${borderRadius("0 6px 6px 0")};
margin: 0;
}
}
${mq.tablet(css`
.orbit-button-primitive {
:first-child {
border-radius: ${({ theme }) =>
borderRadius(`${theme.orbit.borderRadiusNormal} 0 0 ${theme.orbit.borderRadiusNormal}`)};
}
:last-child {
border-radius: ${({ theme }) =>
borderRadius(`0 ${theme.orbit.borderRadiusNormal} ${theme.orbit.borderRadiusNormal} 0`)};
}
}
`)};
`;

StyledButtonGroup.defaultProps = {
theme: defaultTheme,
};

const ButtonGroup = ({ children, dataTest }: Props) => (
<StyledButtonGroup data-test={dataTest}>{children}</StyledButtonGroup>
<div
data-test={dataTest}
className="tb:first:[&>.orbit-button-primitive]:rounded-s-normal tb:last:[&>.orbit-button-primitive]:rounded-e-normal flex space-x-px rtl:space-x-reverse [&>.orbit-button-primitive]:rounded-none first:[&>.orbit-button-primitive]:rounded-s-[6px] last:[&>.orbit-button-primitive]:rounded-e-[6px]"
>
{children}
</div>
);

export default ButtonGroup;

This file was deleted.

14 changes: 0 additions & 14 deletions packages/orbit-components/src/tmp-tailwind/ButtonGroup/index.tsx

This file was deleted.

0 comments on commit 2510a42

Please sign in to comment.