Skip to content

Commit

Permalink
Consolide input-transition props as a theme variable
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Sep 29, 2023
1 parent 430bd9f commit ec45ead
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ window.addEventListener('drop', async e => {
border-radius 4px
padding 0 .6rem
-webkit-app-region: no-drag;
app-region: no-drag;
transition all ease .1s
app-region: no-drag
hover-transition(border-color)
&:hover
border-color var(--tq-color-primary)
Expand Down
15 changes: 8 additions & 7 deletions src/tweeq/FloatingPane/FloatingPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ onMounted(() => {
display grid
grid-template-columns 1fr
grid-template-rows 1fr
transition border-radius .2s ease, border-color .2s ease
hover-transition(border-radius, border-color)
&.minimized
width 3rem
transition width .2s ease
hover-transition(width)
& > .minimized-title
opacity 1
Expand Down Expand Up @@ -174,20 +174,20 @@ onMounted(() => {
.resize
position absolute
transition all .2s ease
hover-transition()
&:before
content ''
position absolute
width 100%
height 100%
background blue
transition all .2s ease
hover-transition()
opacity 0
&:hover:before
opacity 1
transition opacity .2s ease .4s
transition opacity var(--tq-hover-transition-duration) ease .1s
.left
left 0
Expand Down Expand Up @@ -221,11 +221,12 @@ onMounted(() => {
transform translate(-50%, -50%)
pointer-events none
opacity 0
transition opacity .2s ease
hover-transition(opacity)
.content
position relative
height 100%
overflow hidden
transition opacity .2s ease
hover-transition(opacity)
</style>
@/tweaq/useAppStorage
3 changes: 2 additions & 1 deletion src/tweeq/RoundButton/RoundButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defineProps<Props>()
</template>

<style lang="stylus" scoped>
@import '../common.styl'
.RoundButton
height 32px
Expand All @@ -30,11 +31,11 @@ defineProps<Props>()
justify-content center
align-items center
gap .4em
transition all ease .2s
width auto
padding 0 12px 0 6px
background var(--tq-color-primary-container)
color var(--md-sys-color-on-primary-container)
hover-transition(background, color)
&:hover
background var(--tq-color-primary)
Expand Down
15 changes: 12 additions & 3 deletions src/tweeq/Tabs/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ onMounted(() => {
</template>

<style lang="stylus" scoped>
@import '../common.styl'
.Tabs
display grid
gap .5rem
Expand All @@ -160,19 +162,26 @@ onMounted(() => {
.tablist-item
line-height 2rem
padding 0 .4rem
padding 2px .4rem 0
font-weight bold
border-bottom 3px solid transparent
transition border-bottom-color .2s ease
hover-transition(border-bottom-color)
&.active
border-bottom-color var(--tq-color-text)
&:hover
border-bottom-color var(--tq-color-primary)
.tablist-link
text-decoration none
color var(--tq-color-text)
opacity .4
transition opacity .2s ease
hover-transition(opacity)
&:hover
color var(--tq-color-primary)
opacity 1
&.active
opacity 1
Expand Down
11 changes: 11 additions & 0 deletions src/tweeq/common.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ pane()
border 1px solid var(--tq-color-pane-border)
background var(--tq-color-pane)
backdrop-filter blur(4px)

hover-transition(prop = all)
values = ()

for p in arguments
push(
values,
p + ' var(--tq-hover-transition-duration) ease'
)

transition unquote(join(',', values))
2 changes: 2 additions & 0 deletions src/tweeq/useTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface Theme {
// UI Metrics
paneBorderRadius: string
inputHeight: string
hoverTransitionDuration: string
}

const ThemeKey: InjectionKey<Readonly<Ref<Theme>>> = Symbol('tqTheme')
Expand Down Expand Up @@ -98,6 +99,7 @@ export function provideTheme(

paneBorderRadius: '20px',
inputHeight: '16px',
hoverTransitionDuration: '0.15s',
}

// Promote all as CSS variabbles
Expand Down

0 comments on commit ec45ead

Please sign in to comment.