Add plain button (#5419)

* Add plain button

* Minor syntax improvements
This commit is contained in:
Rafael Wendel 2021-03-10 13:42:51 -03:00 committed by GitHub
parent 6cc69ec2c1
commit b2636deef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 0 deletions

View 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();
}

View 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;