-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: radio buttons * feat: radio pillbox style * feat: radio grouped style * refactor: rearranging radio contents * docs: add radio to README * refactor: rename radio pillbox to pill
- Loading branch information
Showing
18 changed files
with
826 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Set Shell zsh | ||
Set Height 650 | ||
Sleep 1s | ||
Type "./radio-grouped" | ||
Enter | ||
Sleep 3s | ||
Right 1 | ||
Sleep 800ms | ||
Right 1 | ||
Sleep 900ms | ||
Right 1 | ||
Sleep 1500ms | ||
Down 1 | ||
Sleep 800ms | ||
Down 1 | ||
Sleep 700ms | ||
Down 1 | ||
Sleep 800ms | ||
Left 1 | ||
Sleep 700ms | ||
Up 1 | ||
Sleep 600ms | ||
Left 1 | ||
Sleep 700ms | ||
Up 1 | ||
Sleep 3s |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Set Shell zsh | ||
Set Height 750 | ||
Sleep 1s | ||
Type "./radio-pill" | ||
Enter | ||
Sleep 3s | ||
Right 1 | ||
Sleep 800ms | ||
Right 1 | ||
Sleep 900ms | ||
Right 1 | ||
Sleep 1500ms | ||
Down 1 | ||
Sleep 800ms | ||
Down 1 | ||
Sleep 700ms | ||
Down 1 | ||
Sleep 800ms | ||
Left 1 | ||
Sleep 700ms | ||
Up 1 | ||
Sleep 600ms | ||
Left 1 | ||
Sleep 700ms | ||
Up 1 | ||
Sleep 3s |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Set Shell zsh | ||
Sleep 1s | ||
Type "./radio-simple" | ||
Enter | ||
Sleep 3s | ||
Right 1 | ||
Sleep 800ms | ||
Right 1 | ||
Sleep 900ms | ||
Right 1 | ||
Sleep 1500ms | ||
Down 1 | ||
Sleep 800ms | ||
Down 1 | ||
Sleep 700ms | ||
Down 1 | ||
Sleep 800ms | ||
Left 1 | ||
Sleep 700ms | ||
Up 1 | ||
Sleep 600ms | ||
Left 1 | ||
Sleep 700ms | ||
Up 1 | ||
Sleep 3s |
File renamed without changes
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Set Shell zsh | ||
Sleep 1s | ||
Type "./demo" | ||
Type "./tabs-wraparound" | ||
Enter | ||
Sleep 3s | ||
Left 1 | ||
|
File renamed without changes
File renamed without changes.
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,75 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
tea "github.com/charmbracelet/bubbletea" | ||
gloss "github.com/charmbracelet/lipgloss" | ||
"github.com/shawalli/bubbles/radio" | ||
) | ||
|
||
type Model struct { | ||
vRadio radio.Model | ||
hRadio radio.Model | ||
} | ||
|
||
func (m Model) Init() tea.Cmd { return nil } | ||
|
||
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | ||
switch msg := msg.(type) { | ||
case tea.KeyMsg: | ||
switch msg.String() { | ||
case "esc", "q", "ctrl+c": | ||
return m, tea.Quit | ||
} | ||
} | ||
|
||
t, _ := m.hRadio.Update(msg) | ||
m.hRadio = t.(radio.Model) | ||
|
||
t, _ = m.vRadio.Update(msg) | ||
m.vRadio = t.(radio.Model) | ||
|
||
return m, nil | ||
} | ||
|
||
func (m Model) View() string { | ||
return gloss.JoinVertical( | ||
gloss.Top, | ||
m.vRadio.View(), | ||
m.hRadio.View(), | ||
) | ||
} | ||
|
||
func main() { | ||
vButtons := []tea.Model{ | ||
radio.NewButton(" 10% "), | ||
radio.NewButton(" 15% "), | ||
radio.NewButton(" 20% "), | ||
radio.NewButton(" 22% "), | ||
radio.NewButton(" 25% "), | ||
radio.NewButton("None "), | ||
} | ||
|
||
hButtons := []tea.Model{ | ||
radio.NewButton(" Pay Cash "), | ||
radio.NewButton("Pay Credit "), | ||
radio.NewButton(" PayBuddy "), | ||
radio.NewButton(" BNPL "), | ||
} | ||
|
||
m := Model{ | ||
vRadio: radio.New(true, vButtons...). | ||
Styles(radio.DefaultGroupedStyles(true)). | ||
Wraparound(true), | ||
hRadio: radio.New(false, hButtons...). | ||
Styles(radio.DefaultGroupedStyles(false)). | ||
Wraparound(true), | ||
} | ||
|
||
if _, err := tea.NewProgram(m).Run(); err != nil { | ||
fmt.Printf("could not run program: %v", err) | ||
os.Exit(1) | ||
} | ||
} |
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,71 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
tea "github.com/charmbracelet/bubbletea" | ||
gloss "github.com/charmbracelet/lipgloss" | ||
"github.com/shawalli/bubbles/radio" | ||
) | ||
|
||
type Model struct { | ||
vRadio radio.Model | ||
hRadio radio.Model | ||
} | ||
|
||
func (m Model) Init() tea.Cmd { return nil } | ||
|
||
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | ||
switch msg := msg.(type) { | ||
case tea.KeyMsg: | ||
switch msg.String() { | ||
case "esc", "q", "ctrl+c": | ||
return m, tea.Quit | ||
} | ||
} | ||
|
||
t, _ := m.hRadio.Update(msg) | ||
m.hRadio = t.(radio.Model) | ||
|
||
t, _ = m.vRadio.Update(msg) | ||
m.vRadio = t.(radio.Model) | ||
|
||
return m, nil | ||
} | ||
|
||
func (m Model) View() string { | ||
return gloss.JoinVertical( | ||
gloss.Top, | ||
m.vRadio.View(), | ||
m.hRadio.View(), | ||
) | ||
} | ||
|
||
func main() { | ||
vButtons := []tea.Model{ | ||
radio.NewButton(" 10% "), | ||
radio.NewButton(" 15% "), | ||
radio.NewButton(" 20% "), | ||
radio.NewButton(" 22% "), | ||
radio.NewButton(" 25% "), | ||
radio.NewButton("None "), | ||
} | ||
|
||
hButtons := []tea.Model{ | ||
radio.NewButton(" Pay Cash "), | ||
radio.NewButton("Pay Credit "), | ||
radio.NewButton(" PayBuddy "), | ||
radio.NewButton(" BNPL "), | ||
} | ||
|
||
m := Model{ | ||
vRadio: radio.New(true, vButtons...).Styles(radio.DefaultPillStyles(true)), | ||
hRadio: radio.New(false, hButtons...).Styles(radio.DefaultPillStyles(false)), | ||
} | ||
|
||
if _, err := tea.NewProgram(m).Run(); err != nil { | ||
fmt.Printf("could not run program: %v", err) | ||
os.Exit(1) | ||
} | ||
} |
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,71 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
tea "github.com/charmbracelet/bubbletea" | ||
gloss "github.com/charmbracelet/lipgloss" | ||
"github.com/shawalli/bubbles/radio" | ||
) | ||
|
||
type Model struct { | ||
vRadio radio.Model | ||
hRadio radio.Model | ||
} | ||
|
||
func (m Model) Init() tea.Cmd { return nil } | ||
|
||
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | ||
switch msg := msg.(type) { | ||
case tea.KeyMsg: | ||
switch msg.String() { | ||
case "esc", "q", "ctrl+c": | ||
return m, tea.Quit | ||
} | ||
} | ||
|
||
t, _ := m.hRadio.Update(msg) | ||
m.hRadio = t.(radio.Model) | ||
|
||
t, _ = m.vRadio.Update(msg) | ||
m.vRadio = t.(radio.Model) | ||
|
||
return m, nil | ||
} | ||
|
||
func (m Model) View() string { | ||
return gloss.JoinVertical( | ||
gloss.Top, | ||
m.vRadio.View(), | ||
m.hRadio.View(), | ||
) | ||
} | ||
|
||
func main() { | ||
vButtons := []tea.Model{ | ||
radio.NewButton("10%"), | ||
radio.NewButton("15%"), | ||
radio.NewButton("20%"), | ||
radio.NewButton("22%"), | ||
radio.NewButton("25%"), | ||
radio.NewButton("None"), | ||
} | ||
|
||
hButtons := []tea.Model{ | ||
radio.NewButton("Pay Cash"), | ||
radio.NewButton("Pay Credit"), | ||
radio.NewButton("PayBuddy"), | ||
radio.NewButton("BNPL"), | ||
} | ||
|
||
m := Model{ | ||
vRadio: radio.New(true, vButtons...), | ||
hRadio: radio.New(false, hButtons...), | ||
} | ||
|
||
if _, err := tea.NewProgram(m).Run(); err != nil { | ||
fmt.Printf("could not run program: %v", err) | ||
os.Exit(1) | ||
} | ||
} |
Oops, something went wrong.