mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 11:35:57 +01:00
Fix styling issues with the popover
Committed-by: Konstantin Schaper <konstantin.schaper@cloudogu.com> Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
@@ -23,14 +23,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { ComponentType, HTMLAttributes, ReactHTML, Ref } from "react";
|
import React, { ComponentType, HTMLAttributes, ReactHTML, Ref } from "react";
|
||||||
import styled from "styled-components";
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import CSS from "csstype";
|
import CSS from "csstype";
|
||||||
|
|
||||||
const CardRowsContainer = styled.div`
|
|
||||||
overflow: hidden;
|
|
||||||
`;
|
|
||||||
|
|
||||||
type Props = HTMLAttributes<HTMLElement> & {
|
type Props = HTMLAttributes<HTMLElement> & {
|
||||||
action?: React.ReactElement;
|
action?: React.ReactElement;
|
||||||
/**
|
/**
|
||||||
@@ -61,12 +56,12 @@ const Card = React.forwardRef<HTMLElement, Props>(
|
|||||||
ref,
|
ref,
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
<CardRowsContainer
|
<div
|
||||||
className="is-flex is-flex-direction-column is-justify-content-center is-flex-grow-1"
|
className="is-flex is-flex-direction-column is-justify-content-center is-flex-grow-1"
|
||||||
style={{ gap: rowGap }}
|
style={{ gap: rowGap }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</CardRowsContainer>,
|
</div>,
|
||||||
action ? <span className="ml-2">{action}</span> : null
|
action ? <span className="ml-2">{action}</span> : null
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { HTMLAttributes } from "react";
|
import React, { HTMLAttributes } from "react";
|
||||||
import classNames from "classnames";
|
|
||||||
|
|
||||||
type Props = HTMLAttributes<HTMLHeadingElement> & {
|
type Props = HTMLAttributes<HTMLHeadingElement> & {
|
||||||
/**
|
/**
|
||||||
@@ -46,11 +45,10 @@ type Props = HTMLAttributes<HTMLHeadingElement> & {
|
|||||||
* @beta
|
* @beta
|
||||||
* @since 2.44.0
|
* @since 2.44.0
|
||||||
*/
|
*/
|
||||||
const CardTitle = React.forwardRef<HTMLHeadingElement, Props>(({ children, level = 3, className, ...props }, ref) =>
|
const CardTitle = React.forwardRef<HTMLHeadingElement, Props>(({ children, level = 3, ...props }, ref) =>
|
||||||
React.createElement(
|
React.createElement(
|
||||||
`h${level}`,
|
`h${level}`,
|
||||||
{
|
{
|
||||||
className: classNames(className, "is-ellipsis-overflow"),
|
|
||||||
ref,
|
ref,
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ export default {
|
|||||||
|
|
||||||
const Template: ComponentStory<typeof Popover> = (args) => <Popover {...args} />;
|
const Template: ComponentStory<typeof Popover> = (args) => <Popover {...args} />;
|
||||||
|
|
||||||
|
export const WithShortBody = Template.bind({});
|
||||||
|
WithShortBody.args = {
|
||||||
|
trigger: <button>a button</button>,
|
||||||
|
title: <h1>A title longer than the body</h1>,
|
||||||
|
children: <div>very short body</div>,
|
||||||
|
};
|
||||||
|
|
||||||
export const CiStatus = Template.bind({});
|
export const CiStatus = Template.bind({});
|
||||||
CiStatus.args = {
|
CiStatus.args = {
|
||||||
trigger: (
|
trigger: (
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ const Popover = React.forwardRef<HTMLDivElement, Props>(({ title, className, tri
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
className={classNames("has-rounded-border", "p-2", "popover-content", "box", "popover", className)}
|
className={classNames("has-rounded-border", "p-2", "popover-content", "box", "popover", className)}
|
||||||
>
|
>
|
||||||
<div className="is-flex">
|
<div className="is-flex is-align-items-center">
|
||||||
<TitleContainer>{title}</TitleContainer>
|
<TitleContainer className="mr-4">{title}</TitleContainer>
|
||||||
<RadixPopover.Close asChild>
|
<RadixPopover.Close asChild>
|
||||||
<button className="delete popover-close" aria-label={t("popover.closeButton.ariaLabel")} />
|
<button className="delete popover-close" aria-label={t("popover.closeButton.ariaLabel")} />
|
||||||
</RadixPopover.Close>
|
</RadixPopover.Close>
|
||||||
|
|||||||
@@ -308,3 +308,11 @@ input[type="date"].input::-webkit-calendar-picker-indicator {
|
|||||||
.popover-close {
|
.popover-close {
|
||||||
background: $background;
|
background: $background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.popover-close:hover {
|
||||||
|
background: $grey-darker !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popover-close:focus {
|
||||||
|
background: $grey-darker !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -380,3 +380,11 @@ input[type="date"].input::-webkit-calendar-picker-indicator {
|
|||||||
.popover-close {
|
.popover-close {
|
||||||
background: $white-ter;
|
background: $white-ter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.popover-close:hover {
|
||||||
|
background: $grey-light !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popover-close:focus {
|
||||||
|
background: $grey-light !important;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user