Skip to content

Commit

Permalink
Style safe area insets only if PUBLIC_STYLE_SAFE_AREA_INSETS is set t…
Browse files Browse the repository at this point in the history
…o true
  • Loading branch information
maiertech committed Sep 16, 2024
1 parent 40b497d commit 83dfe27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ rm -rf ~/.cargo/git/checkouts/*
rd /s /q "%USERPROFILE%\.cargo\git\checkouts"
```

### Debugging

You can simulate safe area insets during development by overriding CSS variables `--safe-area-inset-top` and `--safe-area-inset-button` in `unime/src/app.css`. You can add styling to the safe area insets by setting `PUBLIC_STYLE_SAFE_AREA_INSETS=true` in your `.env`.

## Release a new version

1. Search the entire project for the current version string (such as `0.6.2`) and replace them with the new version string.
Expand Down
1 change: 1 addition & 0 deletions unime/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEV_MODE_ENABLED=false
PUBLIC_DEV_MODE_MENU_EXPANDED=false # https://kit.svelte.dev/docs/modules#$env-static-public
FEATURE_USER_JOURNEYS_ENABLED=false
PUBLIC_STYLE_SAFE_AREA_INSETS=false
11 changes: 8 additions & 3 deletions unime/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { PUBLIC_DEV_MODE_MENU_EXPANDED } from '$env/static/public';
import { PUBLIC_DEV_MODE_MENU_EXPANDED, PUBLIC_STYLE_SAFE_AREA_INSETS } from '$env/static/public';
import LL, { setLocale } from '$i18n/i18n-svelte';
import { loadAllLocales } from '$i18n/i18n-util.sync';
import type { SvelteHTMLElements } from 'svelte/elements';
Expand Down Expand Up @@ -85,6 +85,7 @@
});
let expandedDevMenu = PUBLIC_DEV_MODE_MENU_EXPANDED === 'true';
let styleSafeAreaInsets = PUBLIC_STYLE_SAFE_AREA_INSETS === 'true';
let showDebugMessages = false;
let showDragonProfileSteps = false;
let resetDragonProfile = true;
Expand Down Expand Up @@ -287,7 +288,9 @@ Stacking context: We have to deviate from the DOM-sequence.
<!-- Apply border conditionally when the top inset is not 0. -->
<div
class="grid h-full place-items-center"
style:border-bottom={safeAreaInsetTopHeight > 0 ? '2px dashed rgb(var(--color-text)' : 'none'}
style:border-bottom={safeAreaInsetTopHeight > 0 && styleSafeAreaInsets
? '2px dashed rgb(var(--color-text)'
: 'none'}
></div>
{/if}
</div>
Expand All @@ -297,7 +300,9 @@ Stacking context: We have to deviate from the DOM-sequence.
{#if $appState.dev_mode !== 'Off'}
<div
class="grid h-full place-items-center"
style:border-top={safeAreaInsetBottomHeight > 0 ? '2px dashed rgb(var(--color-text)' : 'none'}
style:border-top={safeAreaInsetBottomHeight > 0 && styleSafeAreaInsets
? '2px dashed rgb(var(--color-text)'
: 'none'}
></div>
{/if}
</div>
Expand Down

0 comments on commit 83dfe27

Please sign in to comment.