-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export ActionBar component for use in overrides
- Loading branch information
1 parent
7c79787
commit 04fd6c5
Showing
5 changed files
with
99 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ReactNode, SyntheticEvent } from "react"; | ||
import getClassNameFactory from "../../lib/get-class-name-factory"; | ||
import styles from "./styles.module.css"; | ||
const getClassName = getClassNameFactory("ActionBarComponent", styles); | ||
|
||
export const ActionBar = ({ | ||
label, | ||
children, | ||
}: { | ||
label?: string; | ||
children?: ReactNode; | ||
}) => ( | ||
<div className={getClassName()}> | ||
{label && <div className={getClassName("actionsLabel")}>{label}</div>} | ||
{children} | ||
</div> | ||
); | ||
|
||
export const Action = ({ | ||
children, | ||
onClick, | ||
}: { | ||
children: ReactNode; | ||
onClick: (e: SyntheticEvent) => void; | ||
}) => ( | ||
<button className={getClassName("action")} onClick={onClick}> | ||
{children} | ||
</button> | ||
); | ||
|
||
ActionBar.Action = Action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.ActionBarComponent { | ||
display: flex; | ||
width: auto; | ||
padding: 4px; | ||
border-top-left-radius: 8px; | ||
border-top-right-radius: 8px; | ||
border-radius: 8px; | ||
background: var(--puck-color-grey-01); | ||
color: var(--puck-color-white); | ||
font-family: var(--puck-font-family); | ||
gap: 4px; | ||
} | ||
|
||
.ActionBarComponent-actionsLabel { | ||
color: var(--puck-color-grey-08); | ||
display: flex; | ||
font-size: var(--puck-font-size-xxxs); | ||
font-weight: 500; | ||
justify-content: center; | ||
align-items: center; | ||
padding-left: 8px; | ||
padding-right: 16px; | ||
margin-right: 8px; | ||
border-right: 0.5px solid var(--puck-color-grey-05); /* Fractional value required due to scaling */ | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
.ActionBarComponent-action { | ||
background: transparent; | ||
border: none; | ||
color: var(--puck-color-grey-08); | ||
cursor: pointer; | ||
padding: 6px 8px; | ||
border-radius: 4px; | ||
overflow: hidden; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
transition: color 50ms ease-in; | ||
} | ||
|
||
.ActionBarComponent-action:focus-visible { | ||
outline: 2px solid var(--puck-color-azure-05); | ||
outline-offset: -2px; | ||
} | ||
|
||
@media (hover: hover) and (pointer: fine) { | ||
.ActionBarComponent-action:hover { | ||
color: var(--puck-color-azure-06); | ||
transition: none; | ||
} | ||
} | ||
|
||
.ActionBarComponent-action:active { | ||
color: var(--puck-color-azure-07); | ||
transition: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters