Skip to content

Commit a2e4861

Browse files
committed
fix(css): typedef issue(#50)
1 parent 82af9bc commit a2e4861

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/core/src/helper/css.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import type { BaseContext } from '../styled'
12
import type { ExpressionType } from '../utils'
23
import { insertExpressions } from '../utils'
34

4-
export function css<T = any>(
5+
export function css<T = BaseContext<any>>(
56
strings: TemplateStringsArray,
67
...interpolations: (ExpressionType<T> | ExpressionType<T>[])[]
78
): ExpressionType<T>[] {

packages/playground/src/App.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import styled, { ThemeProvider } from '@vue-styled-components/core'
2+
import styled, { css, ThemeProvider } from '../../core/dist'
33
import { reactive, ref, computed, onMounted, onUnmounted } from 'vue'
44
import PerformancePanel from './components/PerformancePanel.vue'
55
import BasicTests from './components/BasicTests.vue'
@@ -78,12 +78,21 @@ const Sidebar = styled.aside`
7878
padding: 1rem;
7979
`
8080
81-
const TabButton = styled.button<{ active: boolean }>`
81+
82+
const cs = css`
8283
width: 100%;
8384
padding: 0.75rem 1rem;
8485
margin-bottom: 0.5rem;
8586
background: ${props => props.active ? 'rgba(255, 255, 255, 0.2)' : 'transparent'};
8687
color: white;
88+
`
89+
90+
const TabButton = styled.button<{ active: boolean }>`
91+
width: 100%;
92+
padding: 0.75rem 1rem;
93+
margin-bottom: 0.5rem;
94+
background: ${props => props.theme.active ? 'rgba(255, 255, 255, 0.2)' : 'transparent'};
95+
color: ${props => props.theme.background};
8796
border: 1px solid ${props => props.active ? 'rgba(255, 255, 255, 0.3)' : 'rgba(255, 255, 255, 0.1)'};
8897
border-radius: 8px;
8998
cursor: pointer;

0 commit comments

Comments
 (0)