forked from MetaCubeX/metacubexd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zephyruso
authored and
Zephyruso
committed
Sep 2, 2023
1 parent
a82fe71
commit 5d43ea0
Showing
9 changed files
with
68 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { JSX, Show, createMemo, createSignal } from 'solid-js' | ||
import { renderInTwoColumn } from '~/signals/config' | ||
|
||
const [windowWidth, setWindowWidth] = createSignal(0) | ||
|
||
setWindowWidth(document?.body?.clientWidth) | ||
|
||
window.addEventListener('resize', () => { | ||
setWindowWidth(document.body.clientWidth) | ||
}) | ||
|
||
const ForTwoColumns = (props: { subChild: JSX.Element[] }) => { | ||
const isShowTwoColumns = createMemo( | ||
() => windowWidth() >= 640 && renderInTwoColumn(), | ||
) // 640 is sm size in daisyui | ||
const leftCloumns = createMemo(() => | ||
props.subChild.filter((i, index) => index % 2 === 0 || !isShowTwoColumns()), | ||
) | ||
const rightCloumns = createMemo(() => | ||
props.subChild.filter((i, index) => index % 2 === 1), | ||
) | ||
|
||
return ( | ||
<div class="flex"> | ||
<div class="flex flex-1 flex-col">{leftCloumns()}</div> | ||
<Show when={isShowTwoColumns()}> | ||
<div class="ml-2 flex flex-1 flex-col">{rightCloumns()}</div> | ||
</Show> | ||
</div> | ||
) | ||
} | ||
|
||
export default ForTwoColumns |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters