mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 17:15:17 +00:00
Add plain button (#5419)
* Add plain button * Minor syntax improvements
This commit is contained in:
parent
6cc69ec2c1
commit
b2636deef4
22
client/app/components/PlainButton.less
Normal file
22
client/app/components/PlainButton.less
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
@import (reference, less) "~@/assets/less/ant";
|
||||||
|
|
||||||
|
.plain-button {
|
||||||
|
all: unset;
|
||||||
|
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||||
|
|
||||||
|
.@{dropdown-prefix-cls}-menu-item > & {
|
||||||
|
width: 100%;
|
||||||
|
margin: -5px -12px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.@{menu-prefix-cls}-item > & {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 -16px;
|
||||||
|
padding: 0 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.plain-button-link {
|
||||||
|
.btn-link();
|
||||||
|
}
|
20
client/app/components/PlainButton.tsx
Normal file
20
client/app/components/PlainButton.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import classNames from "classnames";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import "./PlainButton.less";
|
||||||
|
|
||||||
|
interface PlainButtonType extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
|
||||||
|
type?: "link" | "button";
|
||||||
|
}
|
||||||
|
|
||||||
|
function PlainButton({ className, type, ...rest }: PlainButtonType) {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={classNames("plain-button", "clickable", { "plain-button-link": type === "link" }, className)}
|
||||||
|
type="button"
|
||||||
|
{...rest}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PlainButton;
|
Loading…
Reference in New Issue
Block a user