diff --git a/src/components/Form/Checkbox/checkbox.module.css b/src/components/Form/Checkbox/checkbox.module.css index f90da57..ec9234e 100644 --- a/src/components/Form/Checkbox/checkbox.module.css +++ b/src/components/Form/Checkbox/checkbox.module.css @@ -15,7 +15,7 @@ display: block; padding: 0.3rem 0.5rem 0.3rem 2rem; background-color: #f0f0f0; - border-radius: 0.2rem; + border-radius: 0.1rem; cursor: pointer; transition: background-color 500ms; } @@ -27,13 +27,13 @@ .checkbox span::before { content: ''; background-color: #fff; - width: 1rem; - height: 1rem; + width: 20px; + height: 20px; position: absolute; top: 50%; - left: 0.5rem; + left: 5px; transform: translateY(-50%); - border-radius: 0.2rem; + border-radius: 0.1rem; transition: background-color 250ms; } @@ -42,6 +42,14 @@ outline: 0.2rem solid #a1e1aa; } -.checkbox input:checked + span::before { +.checkbox input:checked + span::after { + content: ''; background-color: #2ac93f; + width: 14px; + height: 14px; + position: absolute; + top: 50%; + left: 8px; + transform: translateY(-50%); + border-radius: 0.1rem; } diff --git a/src/components/Form/Radio/radio.module.css b/src/components/Form/Radio/radio.module.css index ab98943..60ef75d 100644 --- a/src/components/Form/Radio/radio.module.css +++ b/src/components/Form/Radio/radio.module.css @@ -43,7 +43,7 @@ top: 50%; left: 0.4rem; transform: translateY(-50%); - border-radius: 1rem; + border-radius: 50%; } .option input:focus + span, @@ -60,5 +60,5 @@ top: 50%; left: 0.6rem; transform: translateY(-50%); - border-radius: 1rem; + border-radius: 50%; } diff --git a/src/components/Generator/Generator.tsx b/src/components/Generator/Generator.tsx index 33f0f3b..5af73da 100644 --- a/src/components/Generator/Generator.tsx +++ b/src/components/Generator/Generator.tsx @@ -15,6 +15,8 @@ export type GeneratorSettings = { font: Font; runtime: 'local' | 'docker-compose'; developmentProxy: boolean; + checkoutGitRequest: 'none' | 'github' | 'gitlab'; + linkGitHooks: boolean; } const Generator = (): ReactElement => { @@ -24,6 +26,7 @@ const Generator = (): ReactElement => { project: 'Taskfile', font: 'Shadow', runtime: 'local', + checkoutGitRequest: 'none', }, }); diff --git a/src/components/Generator/GeneredTaskfile/addons/addons.ts b/src/components/Generator/GeneredTaskfile/addons/addons.ts index 4fa510e..69238e5 100644 --- a/src/components/Generator/GeneredTaskfile/addons/addons.ts +++ b/src/components/Generator/GeneredTaskfile/addons/addons.ts @@ -1,6 +1,8 @@ import { GeneratorSettings } from '@/components/Generator'; import { TaskfileAddons } from '@/components/Generator/GeneredTaskfile/taskfile'; + import runtime from './runtime'; +import git from './git'; /** * Render addons for the Taskfile based on the generator settings @@ -10,6 +12,7 @@ import runtime from './runtime'; */ const renderAddons = (settings: GeneratorSettings, addons: TaskfileAddons): void => { runtime(settings, addons); + git(settings, addons); } export default renderAddons; diff --git a/src/components/Generator/GeneredTaskfile/addons/git/git-link-hooks.sh b/src/components/Generator/GeneredTaskfile/addons/git/git-link-hooks.sh new file mode 100644 index 0000000..44b6e0f --- /dev/null +++ b/src/components/Generator/GeneredTaskfile/addons/git/git-link-hooks.sh @@ -0,0 +1,5 @@ +function project:git-config { + title "Setting git configuration" + git config --local core.hooksPath dev/git-hooks + echo -e "Git hooks directory is set to ${YELLOW}./dev/git-hooks${RESET}." +} diff --git a/src/components/Generator/GeneredTaskfile/addons/git/git.ts b/src/components/Generator/GeneredTaskfile/addons/git/git.ts new file mode 100644 index 0000000..fe40909 --- /dev/null +++ b/src/components/Generator/GeneredTaskfile/addons/git/git.ts @@ -0,0 +1,25 @@ +import { GeneratorSettings } from '@/components/Generator'; +import { TaskfileAddons } from '@/components/Generator/GeneredTaskfile/taskfile'; +import loadTemplate from '@/helpers/loadTemplate'; +import gitLinkHooks from './git-link-hooks.sh'; +import githubFunction from './github-pr-function.sh'; +import gitlabFunction from './gitlab-mr-function.sh'; + +const git = (settings: GeneratorSettings, addon: TaskfileAddons): void => { + if (settings.linkGitHooks) { + addon.projectFunctions.push(loadTemplate(gitLinkHooks)); + + addon.initCheckCommands.push('project:git-config'); + } + + switch (settings.checkoutGitRequest) { + case 'github': + addon.projectFunctions.push(loadTemplate(githubFunction)); + break; + case 'gitlab': + addon.projectFunctions.push(loadTemplate(gitlabFunction)); + break; + } +} + +export default git; diff --git a/src/components/Generator/GeneredTaskfile/addons/git/github-pr-function.sh b/src/components/Generator/GeneredTaskfile/addons/git/github-pr-function.sh new file mode 100644 index 0000000..c4b8670 --- /dev/null +++ b/src/components/Generator/GeneredTaskfile/addons/git/github-pr-function.sh @@ -0,0 +1,16 @@ +function task:pr { ## Check out pull request and update + project:checkout-pr $1 + project:update +} + +function project:checkout-pr { + title "Checking out pull request" + if [ -z "$1" ]; then + echo "You need to provide a pull request number to check out." + echo -e "${BLUE}Usage:${RESET} $0 pr ${YELLOW}${RESET}" + exit 1 + fi + echo "Checking out pull request $1..." + git fetch origin refs/pull/$1/head:refs/remotes/origin/pr/$1 + git checkout origin/pr/$1 +} diff --git a/src/components/Generator/GeneredTaskfile/addons/git/gitlab-mr-function.sh b/src/components/Generator/GeneredTaskfile/addons/git/gitlab-mr-function.sh new file mode 100644 index 0000000..fd2e105 --- /dev/null +++ b/src/components/Generator/GeneredTaskfile/addons/git/gitlab-mr-function.sh @@ -0,0 +1,16 @@ +function task:mr { ## Check out merge request and update + project:checkout-mr $1 + project:update +} + +function project:checkout-mr { + title "Checking out merge request" + if [ -z "$1" ]; then + echo "You need to provide a merge request number to check out." + echo -e "${BLUE}Usage:${RESET} $0 mr ${YELLOW}${RESET}" + exit 1 + fi + echo "Checking out merge request $1..." + git fetch origin refs/merge-requests/$1/head:refs/remotes/origin/merge-requests/$1 + git checkout origin/merge-requests/$1 +} diff --git a/src/components/Generator/GeneredTaskfile/addons/git/index.ts b/src/components/Generator/GeneredTaskfile/addons/git/index.ts new file mode 100644 index 0000000..6dd5242 --- /dev/null +++ b/src/components/Generator/GeneredTaskfile/addons/git/index.ts @@ -0,0 +1 @@ +export {default} from './git' diff --git a/src/components/Generator/Settings/Settings.tsx b/src/components/Generator/Settings/Settings.tsx index 6f894d9..701a4af 100644 --- a/src/components/Generator/Settings/Settings.tsx +++ b/src/components/Generator/Settings/Settings.tsx @@ -59,6 +59,27 @@ const Settings = (): ReactElement => { for local domains instead of ports )} + + + Create git hooks symlink + ) }