Skip to content
5 changes: 5 additions & 0 deletions .changeset/clean-points-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-basic-ui": minor
---

Expose interfaces to modify dimensions of AppBar
11 changes: 11 additions & 0 deletions extensions/plugin-basic-ui/src/basicUIPlugin.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const GLOBAL_VARS = {
"app-bar-background-image-transition-duration",
overflow: "app-bar-overflow",
minSafeAreaInsetTop: "app-bar-min-safe-area-inset-top",
containerPadding: "app-bar-container-padding",
itemGap: "app-bar-item-gap",
fontSize: "app-bar-font-size",
lineHeight: "app-bar-line-height",
hitSlop: "app-bar-hit-slop",
},
bottomSheet: {
borderRadius: "bottom-sheet-border-radius",
Expand Down Expand Up @@ -70,6 +75,11 @@ const androidValues: GlobalVars = {
backgroundImageTransitionDuration: "0s",
overflow: "hidden",
minSafeAreaInsetTop: "0px",
containerPadding: "1rem",
itemGap: "1rem",
fontSize: "1.125rem",
hitSlop: "0.5rem",
lineHeight: "1.5",
},
bottomSheet: {
borderRadius: "1rem",
Expand All @@ -87,6 +97,7 @@ const cupertinoValues: GlobalVars = {
height: "2.75rem",
minHeight: "2.75rem",
borderSize: "0.5px",
lineHeight: "normal",
},
};

Expand Down
6 changes: 6 additions & 0 deletions extensions/plugin-basic-ui/src/basicUIPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export const basicUIPlugin: (
[css.globalVars.bottomSheet.borderRadius]:
_options.bottomSheet?.borderRadius,
[css.globalVars.modal.borderRadius]: _options.modal?.borderRadius,
[css.globalVars.appBar.containerPadding]:
_options.appBar?.containerPadding,
[css.globalVars.appBar.fontSize]: _options.appBar?.fontSize,
[css.globalVars.appBar.lineHeight]: _options.appBar?.lineHeight,
[css.globalVars.appBar.hitSlop]: _options.appBar?.hitSlop,
[css.globalVars.appBar.itemGap]: _options.appBar?.itemGap,
}),
)}
>
Expand Down
38 changes: 15 additions & 23 deletions extensions/plugin-basic-ui/src/components/AppBar.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ export const container = style([
}),
selectors: {
[`${android} &`]: {
padding: "0 1rem",
paddingLeft: globalVars.appBar.containerPadding,
paddingRight: globalVars.appBar.containerPadding,
},
},
},
Expand All @@ -211,16 +212,13 @@ export const left = style([
f.fullHeight,
appBarMinHeight,
{
paddingRight: globalVars.appBar.itemGap,
":empty": {
display: "none",
},
selectors: {
[`${android} &`]: {
paddingRight: "1rem",
},
[`${cupertino} &`]: {
paddingLeft: "1rem",
paddingRight: "1rem",
paddingLeft: globalVars.appBar.containerPadding,
},
},
},
Expand All @@ -237,8 +235,8 @@ export const backButton = style([
opacity: "300ms",
color: globalVars.appBar.iconColorTransitionDuration,
}),
padding: ".5rem",
margin: "-.5rem",
padding: globalVars.appBar.hitSlop,
margin: `calc(-1 * ${globalVars.appBar.hitSlop})`,
":active": {
opacity: "0.2",
transition: transitions({
Expand All @@ -254,8 +252,11 @@ export const closeButton = style([backButton]);
export const center = style([f.flexAlignCenter, f.flex1, appBarMinHeight]);

export const centerMain = style({
width: vars.appBar.center.mainWidth,
display: "flex",
color: globalVars.appBar.textColor,
fontSize: globalVars.appBar.fontSize,
lineHeight: globalVars.appBar.lineHeight,
fontWeight: "bold",
transition: transitions({
height: globalVars.appBar.heightTransitionDuration,
color: globalVars.appBar.textColorTransitionDuration,
Expand All @@ -264,20 +265,15 @@ export const centerMain = style({
[`${android} &`]: {
width: "100%",
justifyContent: "flex-start",
fontSize: "1.125rem",
lineHeight: "1.5",
fontWeight: "bold",
boxSizing: "border-box",
},
[`${cupertino} &`]: {
width: vars.appBar.center.mainWidth,
position: "absolute",
display: "flex",
alignItems: "center",
justifyContent: "center",
textAlign: "center",
fontFamily: "-apple-system, BlinkMacSystemFont",
fontWeight: "bold",
fontSize: "1.125rem",
left: "50%",
transform: "translate(-50%)",
height: globalVars.appBar.height,
Expand All @@ -296,9 +292,9 @@ export const centerMainEdge = style([
f.cursorPointer,
{
left: "50%",
height: "1.25rem",
height: globalVars.appBar.fontSize,
transform: "translate(-50%)",
maxWidth: "5rem",
maxWidth: `calc(${globalVars.appBar.fontSize} * 5)`,
display: "none",
width: vars.appBar.center.mainWidth,
selectors: {
Expand Down Expand Up @@ -326,17 +322,13 @@ export const right = style([
f.posRel,
appBarMinHeight,
{
marginLeft: "auto",
paddingLeft: globalVars.appBar.itemGap,
":empty": {
display: "none",
},
selectors: {
[`${android} &`]: {
paddingLeft: "1rem",
},
[`${cupertino} &`]: {
paddingLeft: "1rem",
paddingRight: "1rem",
paddingRight: globalVars.appBar.containerPadding,
},
},
},
Expand Down
18 changes: 18 additions & 0 deletions extensions/plugin-basic-ui/src/components/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export type AppBarProps = Partial<
| "backgroundColorTransitionDuration"
| "backgroundImage"
| "backgroundImageTransitionDuration"
| "minHeight"
| "fontSize"
| "lineHeight"
| "hitSlop"
| "containerPadding"
| "itemGap"
>
> & {
title?: React.ReactNode;
Expand Down Expand Up @@ -93,6 +99,12 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
onTopClick,
enterStyle,
className,
minHeight,
fontSize,
lineHeight,
hitSlop,
containerPadding,
itemGap,
},
ref,
) => {
Expand Down Expand Up @@ -323,6 +335,12 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
[globalVars.appBar.backgroundImageTransitionDuration]:
backgroundImageTransitionDuration,
[appScreenCss.vars.appBar.center.mainWidth]: `${maxWidth}px`,
[globalVars.appBar.minHeight]: minHeight,
[globalVars.appBar.containerPadding]: containerPadding,
[globalVars.appBar.fontSize]: fontSize,
[globalVars.appBar.hitSlop]: hitSlop,
[globalVars.appBar.lineHeight]: lineHeight,
[globalVars.appBar.itemGap]: itemGap,
}),
)}
data-part="appBar"
Expand Down
Loading