Skip to content

Commit

Permalink
Add optional single column layout to widget
Browse files Browse the repository at this point in the history
Co-authored-by: Adrian Santana Berg <[email protected]>
  • Loading branch information
jonasbrunvoll and adriansberg committed May 30, 2024
1 parent e44df5e commit b8dfd0e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ function WidgetContent({

<ul style={{ listStylePosition: 'inside', marginTop: '1rem' }}>
<li>
<code>.widget-inheritFont</code>: Inherit font family from the
website
<code>.widget-module__inheritFont</code>: Inherit font family from
the website
</li>
<li>
<code>.widget-module__singleColumnLayout</code>: Use single column
design of widget layout
</li>
</ul>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/widget/widget.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,13 @@
.inheritFont * {
font-family: inherit !important;
}

.singleColumnLayout .main {
grid-template-columns: 1fr;
}
.singleColumnLayout .search_container {
max-width: unset;
}
.singleColumnLayout .selector_options {
width: 100%;
}
4 changes: 4 additions & 0 deletions src/widget/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function createSettingsConstants(urlBase: string) {

type OutputOverrideOptions = {
inheritFont?: boolean;
singleColumnLayout?: boolean;
};
export type WidgetOptions = {
urlBase: string;
Expand All @@ -62,6 +63,7 @@ export function createWidget({

const defaultOutputOverrideOptions: OutputOverrideOptions = {
inheritFont: false,
singleColumnLayout: false,
...outputOverrideOptions,
};

Expand Down Expand Up @@ -723,6 +725,8 @@ function createOutput(
<div
class="${style.wrapper} ${style.lightWrapper} ${outputOverrideOptions.inheritFont
? style.inheritFont
: ''} ${outputOverrideOptions.singleColumnLayout
? style.singleColumnLayout
: ''}"
>
<nav class="${style.nav}">
Expand Down

0 comments on commit b8dfd0e

Please sign in to comment.