Skip to content

Commit

Permalink
Add basic Right-to-left (RTL) support
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers committed May 27, 2024
1 parent cfb430b commit 792607e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions JournalApp/Data/PreferenceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public AppTheme SelectedAppTheme
_ => true,
};

public LayoutDirection LayoutDirection => AppInfo.RequestedLayoutDirection;

public bool HideNotes
{
get => _preferenceStore.Get("hide_notes", false);
Expand Down
26 changes: 14 additions & 12 deletions JournalApp/Pages/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@
@inject NavigationManager NavigationManager
@inject PreferenceService PreferenceService

<MudThemeProvider Theme="_theme" IsDarkMode="PreferenceService.IsDarkMode" DefaultScrollbar />
<MudRTLProvider RightToLeft="@(PreferenceService.LayoutDirection == LayoutDirection.RightToLeft)">
<MudThemeProvider Theme="_theme" IsDarkMode="PreferenceService.IsDarkMode" DefaultScrollbar />

<MudPopoverProvider />
<MudPopoverProvider />

<MudDialogProvider MaxWidth="MaxWidth.Small"
FullWidth="true"
NoHeader="false"
CloseButton="false"
CloseOnEscapeKey="false"
Position="DialogPosition.Center" />
<MudDialogProvider MaxWidth="MaxWidth.Small"
FullWidth="true"
NoHeader="false"
CloseButton="false"
CloseOnEscapeKey="false"
Position="DialogPosition.Center" />

<MudSnackbarProvider />
<MudSnackbarProvider />

<div class="page">
@Body
</div>
<div class="page">
@Body
</div>
</MudRTLProvider>

@code {
bool _hasInitiallyRendered;
Expand Down

0 comments on commit 792607e

Please sign in to comment.