-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implemented new button states (#3737)
* feat: implemented new button states * fix: button stories
- Loading branch information
1 parent
b43cd02
commit 6b9cd9e
Showing
29 changed files
with
594 additions
and
36 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...a-subprojects/plugin-base-frontend/src/main/ui-kit/button/assets/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/button/button.stories.ftl
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,33 @@ | ||
<#macro display> | ||
<div id="storybook"> | ||
<p>Just icon</p> | ||
<button class="button"> | ||
<div class="ui-kit-icon ui-kit-icon_placeholder"></div> | ||
</button> | ||
<p>Just label</p> | ||
<button class="button"> | ||
Label | ||
</button> | ||
<p>Icon and background</p> | ||
<button class="button button_background"> | ||
<div class="ui-kit-icon ui-kit-icon_placeholder"></div> | ||
</button> | ||
<p>Icon and label</p> | ||
<button class="button"> | ||
<div class="ui-kit-icon ui-kit-icon_placeholder"></div> | ||
Label | ||
</button> | ||
<p>Icon, background and label</p> | ||
<button class="button button_background"> | ||
<div class="ui-kit-icon ui-kit-icon_placeholder"></div> | ||
Label | ||
</button> | ||
<p>dropdown</p> | ||
<button class="button button_dropdown" onclick="onToggleDropdown(event)"> | ||
</button> | ||
<p>label with dropdown</p> | ||
<button class="button button_dropdown" onclick="onToggleDropdown(event)"> | ||
Label | ||
</button> | ||
</div> | ||
</#macro> |
12 changes: 12 additions & 0 deletions
12
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/button/index.ts
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,12 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import './styles.scss'; | ||
|
||
function onToggleDropdown(event: PointerEvent): void { | ||
(event.target as HTMLButtonElement).classList.toggle('button_dropdown_active'); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(window as any).onToggleDropdown = onToggleDropdown; |
107 changes: 107 additions & 0 deletions
107
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/button/styles.scss
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,107 @@ | ||
/*! | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
@import '../tokens/index'; | ||
|
||
.button { | ||
display: flex; | ||
align-items: center; | ||
|
||
height: 40px; | ||
|
||
padding: var(--size-s2) 12px; | ||
|
||
cursor: pointer; | ||
|
||
letter-spacing: 0.045em; | ||
|
||
color: var(--color-text); | ||
|
||
border: none; | ||
border-radius: var(--size-s1); | ||
|
||
background-color: transparent; | ||
|
||
&:has(:first-child) { | ||
gap: var(--size-s2); | ||
|
||
padding: var(--size-s2); | ||
} | ||
|
||
&:hover { | ||
background-color: var(--color-b08); | ||
} | ||
|
||
&:active { | ||
background-color: var(--color-key-blue); | ||
} | ||
|
||
&:disabled { | ||
cursor: not-allowed; | ||
|
||
opacity: 0.5; | ||
} | ||
|
||
&:focus-visible { | ||
outline: 4px solid var(--color-key-blue-05); | ||
} | ||
|
||
.theme-dark & { | ||
color: var(--color-text-dt); | ||
} | ||
|
||
.theme-dark &:hover { | ||
background-color: var(--color-w10); | ||
} | ||
|
||
&_background { | ||
background-color: var(--color-w100); | ||
|
||
.theme-dark & { | ||
background-color: var(--color-w10); | ||
|
||
&:hover { | ||
background-color: var(--color-w05); | ||
} | ||
} | ||
} | ||
|
||
&_dropdown { | ||
padding: var(--size-s2); | ||
|
||
&::after { | ||
display: block; | ||
|
||
width: var(--size-m1); | ||
height: var(--size-m1); | ||
|
||
content: ''; | ||
transform: rotate(0); | ||
|
||
background-image: url('./assets/arrow-down.svg'); | ||
background-repeat: no-repeat; | ||
will-change: transform; | ||
|
||
filter: invert(1); | ||
|
||
.theme-dark & { | ||
filter: none; | ||
} | ||
} | ||
} | ||
|
||
&_dropdown_active { | ||
color: var(--color-text-dt); | ||
background-color: var(--color-key-blue); | ||
|
||
&:hover, | ||
.theme-dark &:hover { | ||
background-color: lighten(rgb(48, 127, 255), 10%); | ||
} | ||
|
||
&::after { | ||
transform: rotate(-180deg); | ||
filter: invert(0); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/icon/assets/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/icon/assets/placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/icon/index.ts
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,5 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import './styles.scss'; |
32 changes: 32 additions & 0 deletions
32
dokka-subprojects/plugin-base-frontend/src/main/ui-kit/icon/styles.scss
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,32 @@ | ||
/*! | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
@import '../tokens/index'; | ||
|
||
.ui-kit-icon { | ||
width: var(--size-m1); | ||
height: var(--size-m1); | ||
|
||
background-color: transparent; | ||
background-repeat: no-repeat; | ||
background-position: 50% 50%; | ||
background-size: 24px 24px; | ||
|
||
font-size: 0; | ||
line-height: 0; | ||
will-change: background-color; | ||
|
||
filter: invert(1); | ||
|
||
.theme-dark & { | ||
filter: none; | ||
} | ||
} | ||
|
||
.ui-kit-icon_arrow-down { | ||
background-image: url('./assets/arrow-down.svg'); | ||
} | ||
|
||
.ui-kit-icon_placeholder { | ||
background-image: url('./assets/placeholder.svg'); | ||
} |
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
6 changes: 3 additions & 3 deletions
6
...ubprojects/plugin-base-frontend/src/main/ui-kit/navbar-button/assets/burger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions
12
...ubprojects/plugin-base-frontend/src/main/ui-kit/navbar-button/assets/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...projects/plugin-base-frontend/src/main/ui-kit/navbar-button/assets/homepage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...ects/plugin-base-frontend/src/main/ui-kit/navbar-button/assets/theme-toggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
padding: 10px 12px; | ||
|
||
cursor: pointer; | ||
letter-spacing: -0.03em; | ||
|
||
text-transform: capitalize; | ||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/header.ftl
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
3 changes: 3 additions & 0 deletions
3
...a-subprojects/plugin-base/src/main/resources/dokka/ui-kit/assets/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions
6
dokka-subprojects/plugin-base/src/main/resources/dokka/ui-kit/assets/burger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions
12
dokka-subprojects/plugin-base/src/main/resources/dokka/ui-kit/assets/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
dokka-subprojects/plugin-base/src/main/resources/dokka/ui-kit/assets/homepage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...-subprojects/plugin-base/src/main/resources/dokka/ui-kit/assets/placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...subprojects/plugin-base/src/main/resources/dokka/ui-kit/assets/theme-toggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.