Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/real-swans-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-basic-ui": patch
---

Fix edge height
5 changes: 5 additions & 0 deletions .changeset/thirty-melons-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-basic-ui": minor
---

Parameterize default appscreen transition offset and appscreen dim height
6 changes: 6 additions & 0 deletions extensions/plugin-basic-ui/src/basicUIPlugin.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ const GLOBAL_VARS = {
backgroundColor: "background-color",
backgroundImage: "background-image",
dimBackgroundColor: "dim-background-color",
dimHeight: "dim-height",
transitionDuration: "transition-duration",
computedTransitionDuration: "computed-transition-duration",
defaultTransitionOffSet: "default-transition-off-set",
appBar: {
borderColor: "app-bar-border-color",
borderColorTransitionDuration: "app-bar-border-color-transition-duration",
Expand Down Expand Up @@ -59,8 +61,10 @@ const androidValues: GlobalVars = {
backgroundColor: "#fff",
backgroundImage: "unset",
dimBackgroundColor: "rgba(0, 0, 0, 0.15)",
dimHeight: "10rem",
transitionDuration: "0s",
computedTransitionDuration: "0s",
defaultTransitionOffSet: "10rem",
appBar: {
borderColor: "rgba(0, 0, 0, 0.07)",
borderColorTransitionDuration: "0s",
Expand Down Expand Up @@ -98,6 +102,8 @@ const androidValues: GlobalVars = {

const cupertinoValues: GlobalVars = {
...androidValues,
dimHeight: "100%",
defaultTransitionOffSet: "100%",
appBar: {
...androidValues.appBar,
height: "2.75rem",
Expand Down
6 changes: 5 additions & 1 deletion extensions/plugin-basic-ui/src/basicUIPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ export const basicUIPlugin: (
[css.globalVars.backgroundColor]: _options.backgroundColor,
[css.globalVars.backgroundImage]: _options.backgroundImage,
[css.globalVars.dimBackgroundColor]: _options.dimBackgroundColor,
[css.globalVars.transitionDuration]: `${stack.transitionDuration}ms`,
[css.globalVars.dimHeight]: _options.dimHeight,
[css.globalVars.transitionDuration]:
`${stack.transitionDuration}ms`,
[css.globalVars.computedTransitionDuration]:
stack.globalTransitionState === "loading"
? `${stack.transitionDuration}ms`
: "0ms",
[css.globalVars.defaultTransitionOffSet]:
_options.defaultTransitionOffSet,
[css.globalVars.appBar.borderColor]: _options.appBar?.borderColor,
[css.globalVars.appBar.borderSize]: _options.appBar?.borderSize,
[css.globalVars.appBar.height]: _options.appBar?.height,
Expand Down
4 changes: 2 additions & 2 deletions extensions/plugin-basic-ui/src/components/AppBar.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export const appBar = recipe({
position: "absolute",
},
[`${cupertino} ${exitActive} &`]: {
transform: "translate3d(100%, 0, 0)",
transform: `translate3d(${globalVars.defaultTransitionOffSet}, 0, 0)`,
transition: transitions({
...appBarCommonTransition,
transform: "0s",
}),
},
[`${android} &`]: {
opacity: 0,
transform: "translate3d(0, 10rem, 0)",
transform: `translate3d(0, ${globalVars.defaultTransitionOffSet}, 0)`,
transition: transitions({
...appBarCommonTransition,
transform: vars.transitionDuration,
Expand Down
61 changes: 32 additions & 29 deletions extensions/plugin-basic-ui/src/components/AppScreen.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ export const appScreen = recipe({
"exit-active": exitActive,
"exit-done": exitDone,
},
hasAppBar: {
true: {
vars: {
[vars.appBar.topMargin]: globalVars.appBar.height,
},
/**
* When `max()` and `env()` (or `constant()`) supported
*
* - https://caniuse.com/css-env-function
* - https://caniuse.com/css-math-functions
*/
"@supports": {
"(padding: max(0px)) and (padding: constant(safe-area-inset-top))": {
vars: {
[vars.appBar.topMargin]:
`calc(${globalVars.appBar.height} + max(${globalVars.appBar.minSafeAreaInsetTop}, constant(safe-area-inset-top)))`,
},
},
"(padding: max(0px)) and (padding: env(safe-area-inset-top))": {
vars: {
[vars.appBar.topMargin]:
`calc(${globalVars.appBar.height} + max(${globalVars.appBar.minSafeAreaInsetTop}, env(safe-area-inset-top)))`,
},
},
},
},
},
},
});

Expand All @@ -59,9 +86,9 @@ export const dim = style([
{
opacity: 0,
zIndex: vars.zIndexes.dim,
height: globalVars.dimHeight,
selectors: {
[`${android} &`]: {
height: "10rem",
background: `linear-gradient(${globalVars.dimBackgroundColor}, rgba(0, 0, 0, 0))`,
},
[`
Expand Down Expand Up @@ -89,7 +116,7 @@ export const paper = recipe({
zIndex: vars.zIndexes.paper,
selectors: {
[`${cupertino} &`]: {
transform: "translate3d(100%, 0, 0)",
transform: `translate3d(${globalVars.defaultTransitionOffSet}, 0, 0)`,
},
[`
${cupertino} ${enterActive} &,
Expand All @@ -99,7 +126,7 @@ export const paper = recipe({
},
[`${android} &`]: {
opacity: 0,
transform: "translate3d(0, 10rem, 0)",
transform: `translate3d(0, ${globalVars.defaultTransitionOffSet}, 0)`,
},
[`
${android} ${enterActive} &,
Expand All @@ -118,30 +145,6 @@ export const paper = recipe({
{
transition: `transform ${vars.transitionDuration}, opacity ${vars.transitionDuration}, margin-top ${globalVars.appBar.heightTransitionDuration}`,
paddingTop: vars.appBar.topMargin,
vars: {
[vars.appBar.topMargin]: globalVars.appBar.height,
},
/**
* When `max()` and `env()` (or `constant()`) supported
*
* - https://caniuse.com/css-env-function
* - https://caniuse.com/css-math-functions
*/
"@supports": {
"(padding: max(0px)) and (padding: constant(safe-area-inset-top))":
{
vars: {
[vars.appBar.topMargin]:
`calc(${globalVars.appBar.height} + max(${globalVars.appBar.minSafeAreaInsetTop}, constant(safe-area-inset-top)))`,
},
},
"(padding: max(0px)) and (padding: env(safe-area-inset-top))": {
vars: {
[vars.appBar.topMargin]:
`calc(${globalVars.appBar.height} + max(${globalVars.appBar.minSafeAreaInsetTop}, env(safe-area-inset-top)))`,
},
},
},
},
],
},
Expand Down Expand Up @@ -202,8 +205,8 @@ export const edge = recipe({
variants: {
hasAppBar: {
true: {
top: globalVars.appBar.height,
height: `calc(100% - ${globalVars.appBar.height})`,
top: vars.appBar.topMargin,
height: `calc(100% - ${vars.appBar.topMargin})`,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions extensions/plugin-basic-ui/src/components/AppScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
ref={appScreenRef}
className={clsx(
css.appScreen({
hasAppBar,
transitionState:
transitionState === "enter-done" ||
transitionState === "exit-done"
Expand Down
Loading