Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
ui
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Code
Merge requests
12
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
ui
Commits
5ece843a
Commit
5ece843a
authored
2 years ago
by
Kasper Seweryn
🥞
Browse files
Options
Downloads
Patches
Plain Diff
Add round and icon buttons
parent
e8671b9d
No related branches found
No related tags found
1 merge request
!1
Implement all components
Pipeline
#23283
failed with stages
in 3 minutes and 39 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/components/button/index.md
+46
-0
46 additions, 0 deletions
docs/components/button/index.md
src/components/button/Button.vue
+12
-2
12 additions, 2 deletions
src/components/button/Button.vue
src/components/button/style.scss
+9
-1
9 additions, 1 deletion
src/components/button/style.scss
with
67 additions
and
3 deletions
docs/components/button/index.md
+
46
−
0
View file @
5ece843a
...
...
@@ -58,6 +58,27 @@ const click = () => new Promise((r, resolve) => setTimeout(resolve, 1000))
Outline button
</fw-button>
## Button shapes
### Normal
```
html
<fw-button>
Normal button
</fw-button>
```
<fw-button>
Normal button
</fw-button>
### Round
```
html
<fw-button
round
>
Round button
</fw-button>
```
<fw-button
round
>
Round button
</fw-button>
## Button states
### Disabled
```
html
...
...
@@ -112,3 +133,28 @@ const click = () => new Promise(resolve => setTimeout(resolve, 1000))
<fw-button
@
click=
"click"
>
Click me
</fw-button>
## Icons
You can use
[
Bootstrap Icons
](
https://icons.getbootstrap.com/
)
in your button component
::: info
When the button doesn't have any contents or it's contents are empty, it will shrink down to the icon size.
To avoid this, you can add
` `
.
:::
```
html
<fw-button
secondary
icon=
"bi-three-dots-vertical"
/>
<fw-button
secondary
is-round
icon=
"bi-x"
/>
<fw-button
icon=
"bi-save"
>
</fw-button>
<fw-button
destructive
icon=
"bi-trash"
>
Delete
</fw-button>
```
<fw-button
secondary
icon=
"bi-three-dots-vertical"
/>
<fw-button
secondary
round
icon=
"bi-x"
/>
<fw-button
icon=
"bi-save"
>
</fw-button>
<fw-button
destructive
icon=
"bi-trash"
>
Delete
</fw-button>
This diff is collapsed.
Click to expand it.
src/components/button/Button.vue
+
12
−
2
View file @
5ece843a
<
script
setup
lang=
"ts"
>
import
{
type
TypeProps
,
useType
}
from
'
~/composables/useType
'
import
{
FwLoader
}
from
'
~/components
'
import
{
ref
,
computed
}
from
'
vue
'
import
{
ref
,
computed
,
useSlots
}
from
'
vue
'
interface
Props
extends
TypeProps
{
outline
?:
boolean
...
...
@@ -9,6 +9,9 @@ interface Props extends TypeProps {
isActive
?:
boolean
isLoading
?:
boolean
round
?:
boolean
icon
?:
string
onClick
?:
(...
args
:
any
[])
=>
void
|
Promise
<
void
>
// TODO (wvffle): Remove after https://github.com/vuejs/core/pull/4512 is merged
...
...
@@ -21,6 +24,9 @@ const props = defineProps<Props>()
const
type
=
useType
(
props
)
const
slots
=
useSlots
()
const
iconOnly
=
computed
(()
=>
!!
props
.
icon
&&
!
slots
.
default
)
const
internalLoader
=
ref
(
false
)
const
isLoading
=
computed
(()
=>
props
.
isLoading
||
internalLoader
.
value
)
...
...
@@ -38,10 +44,14 @@ const click = async (...args: any[]) => {
<
template
>
<button
class=
"funkwhale input button"
:class=
"[type,
{ 'is-active': isActive, 'is-outline': outline, 'is-loading': isLoading }]"
:class=
"[type,
{ 'is-active': isActive, 'is-outline': outline, 'is-loading': isLoading
, 'icon-only': iconOnly, 'is-round': round
}]"
@click="click"
>
<span>
<i
v-if=
"icon"
:class=
"['bi', icon]"
/>
<slot
/>
</span>
...
...
This diff is collapsed.
Click to expand it.
src/components/button/style.scss
+
9
−
1
View file @
5ece843a
...
...
@@ -10,7 +10,6 @@
font-family
:
$font-main
;
font-weight
:
900
;
min-width
:
8
.5rem
;
height
:
2
.125rem
;
line-height
:
1rem
;
...
...
@@ -19,6 +18,15 @@
padding
:
0
.5rem
;
border-radius
:
var
(
--
fw-border-radius
);
margin
:
0
0
.5ch
;
&
:not
(
.icon-only
)
{
min-width
:
8
.5rem
;
}
&
.is-round
{
border-radius
:
100vh
;
}
&
[
disabled
]
{
font-weight
:
normal
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment