generated from sonofmagic/npm-lib-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: hmr codegen and add log option (#17)
* chore: commit panda and tw demo * feat: commit buttons * fix: hmr codegen and add log option
- Loading branch information
1 parent
0b049dc
commit 54d4bc7
Showing
17 changed files
with
619 additions
and
518 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
Large diffs are not rendered by default.
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 |
---|---|---|
|
@@ -20,4 +20,4 @@ dist | |
*.sln | ||
*.sw? | ||
|
||
src/styled-system | ||
styled-system |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<view :class="className"> | ||
<slot></slot> | ||
</view> | ||
</template> | ||
|
||
<script lang="ts"> | ||
// tailwindcss | ||
import { defineComponent } from 'vue' | ||
import type { PropType } from 'vue' | ||
import { cva } from "styled-system/css"; | ||
import type { RecipeVariantProps } from 'styled-system/css' | ||
const button = cva({ | ||
base: { | ||
fontWeight: 'semibold', | ||
borderWidth: '1px', | ||
rounded: 'md' | ||
}, | ||
variants: { | ||
intent: { | ||
primary: { | ||
bg: 'blue.500', | ||
color: 'white', | ||
borderColor: 'transparent', | ||
_hover: { | ||
bg: 'blue.600' | ||
} | ||
}, | ||
secondary: { | ||
bg: 'white', | ||
color: 'gray.800', | ||
borderColor: 'gray.400', | ||
_hover: { | ||
bg: 'gray.100' | ||
} | ||
} | ||
}, | ||
size: { | ||
small: { | ||
fontSize: 'sm', | ||
py: '1', | ||
px: '2' | ||
}, | ||
medium: { | ||
fontSize: 'md', | ||
py: '2', | ||
px: '4' | ||
} | ||
} | ||
}, | ||
compoundVariants: [ | ||
{ | ||
intent: "primary", | ||
size: "medium", | ||
css: { | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
], | ||
defaultVariants: { | ||
intent: "primary", | ||
size: "medium", | ||
} | ||
}); | ||
type StyleProps = RecipeVariantProps<typeof button> | ||
export default defineComponent({ | ||
props: { | ||
intent: { | ||
type: [String] as PropType<StyleProps['intent']> | ||
}, | ||
size: { | ||
type: [String] as PropType<StyleProps['size']> | ||
} | ||
}, | ||
setup(props) { | ||
return { | ||
className: button({ | ||
intent: props.intent, | ||
size: props.size | ||
}) | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped></style> |
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,74 @@ | ||
<template> | ||
<view :class="className"> | ||
<slot></slot> | ||
</view> | ||
</template> | ||
|
||
<script lang="ts"> | ||
// tailwindcss | ||
import { defineComponent } from 'vue' | ||
import type { PropType } from 'vue' | ||
import { cva } from "class-variance-authority"; | ||
import type { VariantProps } from 'class-variance-authority' | ||
const button = cva(["font-semibold", "border", "rounded"], { | ||
variants: { | ||
intent: { | ||
primary: [ | ||
"bg-blue-500", | ||
"text-white", | ||
"border-transparent", | ||
"hover:bg-blue-600", | ||
], | ||
// **or** | ||
// primary: "bg-blue-500 text-white border-transparent hover:bg-blue-600", | ||
secondary: [ | ||
"bg-white", | ||
"text-gray-800", | ||
"border-gray-400", | ||
"hover:bg-gray-100", | ||
], | ||
}, | ||
size: { | ||
small: ["text-sm", "py-1", "px-2"], | ||
medium: ["text-base", "py-2", "px-4"], | ||
}, | ||
}, | ||
compoundVariants: [ | ||
{ | ||
intent: "primary", | ||
size: "medium", | ||
class: "uppercase", | ||
}, | ||
], | ||
defaultVariants: { | ||
intent: "primary", | ||
size: "medium", | ||
}, | ||
}); | ||
type StyleProps = VariantProps<typeof button> | ||
export default defineComponent({ | ||
props: { | ||
intent: { | ||
type: [String] as PropType<StyleProps['intent']> | ||
}, | ||
size: { | ||
type: [String] as PropType<StyleProps['size']> | ||
} | ||
}, | ||
setup(props) { | ||
return { | ||
className: button({ | ||
intent: props.intent, | ||
size: props.size | ||
}) | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped></style> |
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,11 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['./src/**/*.{js,jsx,ts,tsx,vue}'], | ||
theme: { | ||
extend: {} | ||
}, | ||
plugins: [], | ||
corePlugins: { | ||
preflight: false | ||
} | ||
} |
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
Oops, something went wrong.