-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor SwitchField to Toggle component
- Loading branch information
Showing
14 changed files
with
88 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ jobs: | |
license: ${{ steps.get-package.outputs.license }} | ||
deb-pkg-name: ${{ steps.get-package.outputs.name }}_${{ steps.get-package.outputs.version }}_amd64.deb | ||
deb-pkg-path: ./src-tauri/target/release/bundle/deb/ | ||
tag-exists: ${{ steps.get-package.outputs.tag_exists }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup node | ||
|
@@ -37,12 +38,15 @@ jobs: | |
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT | ||
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | ||
echo "description=$(node -p "require('./package.json').description")" >> $GITHUB_OUTPUT | ||
# - uses: dev-drprasad/[email protected] | ||
# with: | ||
# tag_name: ${{ steps.get-package.outputs.version }} | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
build-tauri: | ||
if: ${{ needs.setup.outputs.tag-exists }} == 'true' | ||
needs: [setup] | ||
permissions: | ||
contents: write | ||
|
@@ -52,6 +56,7 @@ jobs: | |
platform: [macos-latest, ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
env: | ||
TAG_EXISTS: ${{ needs.setup.outputs.tag-exists }} | ||
BIN_PATH: ${{ needs.setup.outputs.name-bin }} | ||
DESCRIPTION: ${{ needs.setup.outputs.description }} | ||
LICENSE: ${{ needs.setup.outputs.license }} | ||
|
@@ -71,12 +76,22 @@ jobs: | |
with: | ||
node-version: 20 | ||
|
||
- uses: mukunku/[email protected] | ||
id: checkTag | ||
with: | ||
tag: '${{ env.PACKAGE_VERSION }}' | ||
|
||
- name: stop jobs if tag exist | ||
if: steps.checkTag.outputs.exists == 'true' | ||
run: exit 1 | ||
|
||
- name: install rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: install dependencies (ubuntu only) | ||
if: matrix.platform == 'ubuntu-latest' | ||
run: | | ||
echo "${{ steps.checkTag.outputs.exists }}" | ||
sudo apt-get update | ||
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb | ||
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb | ||
|
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// prettier.config.js | ||
export default { | ||
trailingComma: "es5", | ||
singleQuote: false, | ||
printWidth: 120, | ||
tabWidth: 2, | ||
arrowParens: "always", | ||
plugins: ["prettier-plugin-organize-imports", "prettier-plugin-tailwindcss"], | ||
}; |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { FiCheck } from "solid-icons/fi"; | ||
import { VsClose } from "solid-icons/vs"; | ||
import { Component, Setter } from "solid-js"; | ||
|
||
type SwitchProps = { | ||
checked?: boolean; | ||
onChange: (val: boolean) => Promise<void> | Setter<boolean> | undefined; | ||
}; | ||
|
||
const Toggle: Component<SwitchProps> = (props) => { | ||
return ( | ||
<div class="relative inline-flex cursor-pointer items-center"> | ||
<input | ||
type="checkbox" | ||
checked={props.checked} | ||
onChange={() => props.onChange(!props.checked)} | ||
class="peer sr-only" | ||
/> | ||
<div | ||
class={`peer relative h-4 w-11 rounded-full bg-gray-200 after:absolute after:start-[2px] after:h-4 after:w-4 after:rounded-full after:border after:border-transparent after:bg-white after:transition-all after:content-[''] peer-checked:bg-indigo-600 peer-checked:after:translate-x-[150%] peer-checked:after:border-transparent peer-focus:outline-none rtl:peer-checked:after:-translate-x-full dark:border-gray-600 ${ | ||
props.checked ? "dark:bg-gray-700" : "dark:bg-red-600" | ||
} dark:bg-opacity-20 after:dark:bg-zinc-700`} | ||
> | ||
{props.checked ? ( | ||
<FiCheck class="absolute left-0 top-0 z-50 translate-x-[160%]" /> | ||
) : ( | ||
<VsClose class="absolute left-0 top-0 z-50" /> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Toggle; |
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
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