diff --git a/gradle/changelog/simplify_styling.yaml b/gradle/changelog/simplify_styling.yaml new file mode 100644 index 0000000000..e1f638db37 --- /dev/null +++ b/gradle/changelog/simplify_styling.yaml @@ -0,0 +1,2 @@ +- type: Changed + description: Replace styled-components with bulma helpers ([#1783](https://github.com/scm-manager/scm-manager/pull/1783)) diff --git a/scm-plugins/scm-git-plugin/src/main/js/ProtocolInformation.tsx b/scm-plugins/scm-git-plugin/src/main/js/ProtocolInformation.tsx index 13f506029d..360f314dda 100644 --- a/scm-plugins/scm-git-plugin/src/main/js/ProtocolInformation.tsx +++ b/scm-plugins/scm-git-plugin/src/main/js/ProtocolInformation.tsx @@ -27,18 +27,14 @@ import { Repository, Link } from "@scm-manager/ui-types"; import { ButtonAddons, Button } from "@scm-manager/ui-components"; import CloneInformation from "./CloneInformation"; -const Wrapper = styled.div` - position: relative; -`; - const Switcher = styled(ButtonAddons)` position: absolute; top: 0; right: 0; `; -const SmallButton = styled(Button).attrs(props => ({ - className: "is-small" +const SmallButton = styled(Button).attrs((props) => ({ + className: "is-small", }))` height: inherit; `; @@ -70,13 +66,13 @@ export default class ProtocolInformation extends React.Component { constructor(props: Props) { super(props); this.state = { - selected: selectHttpOrFirst(props.repository) + selected: selectHttpOrFirst(props.repository), }; } selectProtocol = (protocol: Link) => { this.setState({ - selected: protocol + selected: protocol, }); }; @@ -116,10 +112,10 @@ export default class ProtocolInformation extends React.Component { } return ( - +
{protocols.map(this.renderProtocolButton)} {cloneInformation} - +
); } } diff --git a/scm-ui/ui-components/src/BranchSelector.tsx b/scm-ui/ui-components/src/BranchSelector.tsx index 062221ce57..c530eb7344 100644 --- a/scm-ui/ui-components/src/BranchSelector.tsx +++ b/scm-ui/ui-components/src/BranchSelector.tsx @@ -44,10 +44,6 @@ const MinWidthControl = styled.div` min-width: 10rem; `; -const NoBottomMarginField = styled.div` - margin-bottom: 0 !important; -`; - const BranchSelector: FC = ({ branches, onSelectBranch, selectedBranch, label, disabled }) => { if (branches) { return ( @@ -56,7 +52,7 @@ const BranchSelector: FC = ({ branches, onSelectBranch, selectedBranch, l
- +
({ value: g, label: g }))} value={currentGroup} onChange={groupSelected} @@ -89,9 +89,9 @@ const OverviewPageActions: FC = ({ }; return ( -
+
{groupSelector} -
+
{ const replacements = [ { textToReplace: "'", replacement: , - replaceAll: true + replaceAll: true, }, { textToReplace: "`", replacement: , - replaceAll: true - } + replaceAll: true, + }, ]; return ( <> - +
- - +
+
- +
); }); diff --git a/scm-ui/ui-components/src/Tag.tsx b/scm-ui/ui-components/src/Tag.tsx index 7fc9ae4493..b1f0840c76 100644 --- a/scm-ui/ui-components/src/Tag.tsx +++ b/scm-ui/ui-components/src/Tag.tsx @@ -21,10 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -import React, { FC, HTMLAttributes } from "react"; +import React, { FC } from "react"; import classNames from "classnames"; import { Color, Size } from "./styleConstants"; -import styled, { css } from "styled-components"; type Props = { className?: string; @@ -39,19 +38,7 @@ type Props = { onRemove?: () => void; }; -type InnerTagProps = HTMLAttributes & { - small: boolean; -}; - -const smallMixin = css` - font-size: 0.7rem !important; - padding: 0.25rem !important; - font-weight: bold; -`; - -const InnerTag = styled.span` - ${(props) => props.small && smallMixin}; -`; +const smallClassNames = classNames("p-1", "is-size-7", "has-text-weight-bold"); const Tag: FC = ({ className, @@ -82,20 +69,26 @@ const Tag: FC = ({ return ( <> - {showIcon} {label} {children} - + {showDelete} ); diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap index a0cc61cf35..6d32a2e9bd 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -8,7 +8,7 @@ exports[`Storyshots Annotate Default 1`] = ` className="panel-block" >