tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
pull out unused button props
awarm.space
4 months ago
fb070437
8afc0e8f
+18
-8
1 changed file
expand all
collapse all
unified
split
components
ActionBar
ActionButton.tsx
+18
-8
components/ActionBar/ActionButton.tsx
···
8
8
type ButtonProps = Omit<JSX.IntrinsicElements["button"], "content">;
9
9
10
10
export const ActionButton = (
11
11
-
props: ButtonProps & {
11
11
+
_props: ButtonProps & {
12
12
id?: string;
13
13
icon: React.ReactNode;
14
14
label: React.ReactNode;
···
20
20
labelOnMobile?: boolean;
21
21
},
22
22
) => {
23
23
-
let { id, icon, label, primary, secondary, nav, ...buttonProps } = props;
23
23
+
let {
24
24
+
id,
25
25
+
icon,
26
26
+
label,
27
27
+
primary,
28
28
+
secondary,
29
29
+
nav,
30
30
+
labelOnMobile,
31
31
+
subtext,
32
32
+
className,
33
33
+
...buttonProps
34
34
+
} = _props;
24
35
let sidebar = useContext(SidebarContext);
25
36
let inOpenPopover = useContext(PopoverOpenContext);
26
37
useEffect(() => {
···
31
42
};
32
43
}
33
44
}, [sidebar, inOpenPopover]);
34
34
-
45
45
+
35
46
let showLabelOnMobile =
36
36
-
props.labelOnMobile !== false &&
37
37
-
(props.primary || props.secondary || props.nav);
47
47
+
labelOnMobile !== false && (primary || secondary || nav);
38
48
39
49
return (
40
50
<button
···
54
64
? "border-transparent text-secondary sm:hover:border-border justify-start!"
55
65
: "border-transparent text-accent-contrast sm:hover:border-accent-contrast"
56
66
}
57
57
-
${props.className}
67
67
+
${className}
58
68
`}
59
69
>
60
70
<div className="shrink-0">{icon}</div>
···
62
72
className={`flex flex-col pr-1 leading-snug max-w-full min-w-0 ${sidebar.open ? "block" : showLabelOnMobile ? "sm:hidden block" : "hidden"}`}
63
73
>
64
74
<div className="truncate text-left pt-[1px]">{label}</div>
65
65
-
{props.subtext && (
75
75
+
{subtext && (
66
76
<div className="text-xs text-tertiary font-normal text-left">
67
67
-
{props.subtext}
77
77
+
{subtext}
68
78
</div>
69
79
)}
70
80
</div>