This repository was archived by the owner on Mar 4, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Clark Du <[email protected]>
- Loading branch information
Showing
8 changed files
with
321 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
packages/cna-template/template/frameworks/chakra-ui/layouts/default.vue
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,30 @@ | ||
<template> | ||
<div class="container"> | ||
<CThemeProvider> | ||
<CColorModeProvider> | ||
<CBox font-family="body" as="main"> | ||
<CReset /> | ||
<Nuxt /> | ||
</CBox> | ||
</CColorModeProvider> | ||
</CThemeProvider> | ||
</div> | ||
</template> | ||
<script> | ||
import { | ||
CThemeProvider, | ||
CColorModeProvider, | ||
CReset, | ||
CBox | ||
} from '@chakra-ui/vue' | ||
export default { | ||
name: 'App', | ||
components: { | ||
CThemeProvider, | ||
CColorModeProvider, | ||
CReset, | ||
CBox | ||
} | ||
} | ||
</script> |
6 changes: 6 additions & 0 deletions
6
packages/cna-template/template/frameworks/chakra-ui/package.json
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,6 @@ | ||
{ | ||
"dependencies": { | ||
"@chakra-ui/nuxt": "^0.0.7", | ||
"@nuxtjs/emotion": "^0.0.1" | ||
} | ||
} |
168 changes: 168 additions & 0 deletions
168
packages/cna-template/template/frameworks/chakra-ui/pages/index.vue
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,168 @@ | ||
<template> | ||
<div class="container"> | ||
<CBox | ||
v-bind="mainStyles[colorMode]" | ||
d="flex" | ||
w="100vw" | ||
h="100vh" | ||
flex-dir="column" | ||
justify-content="center" | ||
> | ||
<CHeading text-align="center" mb="4"> | ||
⚡️ Hello chakra-ui/vue | ||
</CHeading> | ||
<CFlex justify="center" direction="column" align="center"> | ||
<CBox mb="3"> | ||
<CIconButton | ||
mr="3" | ||
:icon="colorMode === 'light' ? 'moon' : 'sun'" | ||
:aria-label="`Switch to ${ | ||
colorMode === 'light' ? 'dark' : 'light' | ||
} mode`" | ||
@click="toggleColorMode" | ||
/> | ||
<CButton | ||
left-icon="info" | ||
variant-color="blue" | ||
@click="showToast" | ||
> | ||
Show Toast | ||
</CButton> | ||
</CBox> | ||
<CAvatarGroup> | ||
<CAvatar | ||
name="Evan You" | ||
alt="Evan You" | ||
src="https://pbs.twimg.com/profile_images/1206997998900850688/cTXTQiHm_400x400.jpg" | ||
> | ||
<CAvatarBadge size="1.0em" bg="green.500" /> | ||
</CAvatar> | ||
<CAvatar | ||
name="Jonathan Bakebwa" | ||
alt="Jonathan Bakebwa" | ||
src="https://res.cloudinary.com/xtellar/image/upload/v1572857445/me_zqos4e.jpg" | ||
> | ||
<CAvatarBadge size="1.0em" bg="green.500" /> | ||
</CAvatar> | ||
<CAvatar | ||
name="Segun Adebayo" | ||
alt="Segun Adebayo" | ||
src="https://pbs.twimg.com/profile_images/1169353373012897802/skPUWd6e_400x400.jpg" | ||
> | ||
<CAvatarBadge size="1.0em" bg="green.500" /> | ||
</CAvatar> | ||
<CAvatar src="pop"> | ||
<CAvatarBadge size="1.0em" border-color="papayawhip" bg="tomato" /> | ||
</CAvatar> | ||
</CAvatarGroup> | ||
<CButton | ||
left-icon="close" | ||
variant-color="red" | ||
mt="3" | ||
@click="showModal = true" | ||
> | ||
Delete Account | ||
</CButton> | ||
<CModal :is-open="showModal"> | ||
<CModalOverlay /> | ||
<CModalContent> | ||
<CModalHeader>Are you sure?</CModalHeader> | ||
<CModalBody>Deleting user cannot be undone</CModalBody> | ||
<CModalFooter> | ||
<CButton @click="showModal = false"> | ||
Cancel | ||
</CButton> | ||
<CButton | ||
margin-left="3" | ||
variant-color="red" | ||
@click="showModal = false" | ||
> | ||
Delete User | ||
</CButton> | ||
</CModalFooter> | ||
<CModalCloseButton @click="showModal = false" /> | ||
</CModalContent> | ||
</CModal> | ||
</CFlex> | ||
</CBox> | ||
</div> | ||
</template> | ||
|
||
<script lang="js"> | ||
import { | ||
CBox, | ||
CButton, | ||
CAvatarGroup, | ||
CAvatar, | ||
CAvatarBadge, | ||
CModal, | ||
CModalContent, | ||
CModalOverlay, | ||
CModalHeader, | ||
CModalFooter, | ||
CModalBody, | ||
CModalCloseButton, | ||
CIconButton, | ||
CFlex, | ||
CHeading | ||
} from '@chakra-ui/vue' | ||
export default { | ||
name: 'App', | ||
inject: ['$chakraColorMode', '$toggleColorMode'], | ||
components: { | ||
CBox, | ||
CButton, | ||
CAvatarGroup, | ||
CAvatar, | ||
CAvatarBadge, | ||
CModal, | ||
CModalContent, | ||
CModalOverlay, | ||
CModalHeader, | ||
CModalFooter, | ||
CModalBody, | ||
CModalCloseButton, | ||
CIconButton, | ||
CFlex, | ||
CHeading | ||
}, | ||
data () { | ||
return { | ||
showModal: false, | ||
mainStyles: { | ||
dark: { | ||
bg: 'gray.700', | ||
color: 'whiteAlpha.900' | ||
}, | ||
light: { | ||
bg: 'white', | ||
color: 'gray.900' | ||
} | ||
} | ||
} | ||
}, | ||
computed: { | ||
colorMode () { | ||
return this.$chakraColorMode() | ||
}, | ||
theme () { | ||
return this.$chakraTheme() | ||
}, | ||
toggleColorMode () { | ||
return this.$toggleColorMode | ||
} | ||
}, | ||
methods: { | ||
showToast () { | ||
this.$toast({ | ||
title: 'Account created.', | ||
description: "We've created your account for you.", | ||
status: 'success', | ||
duration: 10000, | ||
isClosable: true | ||
}) | ||
} | ||
} | ||
} | ||
</script> |
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
Binary file modified
BIN
+165 Bytes
(100%)
packages/create-nuxt-app/test/snapshots/index.test.js.snap
Binary file not shown.