-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Make styling consistent #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package setup | |
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/charmbracelet/bubbles/key" | ||
| "github.com/charmbracelet/bubbles/list" | ||
| "github.com/charmbracelet/bubbles/textinput" | ||
|
|
@@ -27,7 +28,6 @@ func (p flag) FilterValue() string { return "" } | |
|
|
||
| type flagModel struct { | ||
| input string | ||
| err error | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused. |
||
| textInput textinput.Model | ||
| } | ||
|
|
||
|
|
@@ -69,9 +69,11 @@ func (m flagModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| } | ||
|
|
||
| func (m flagModel) View() string { | ||
| style := lipgloss.NewStyle(). | ||
| MarginLeft(2) | ||
|
|
||
| return fmt.Sprintf( | ||
| "Name your first feature flag (enter for default value):\n\n%s\n\n%s", | ||
| m.textInput.View(), | ||
| "(esc to quit)", | ||
| "Name your first feature flag (enter for default value):\n\n%s", | ||
| style.Render(m.textInput.View()), | ||
| ) + "\n" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import ( | |
|
|
||
| tea "github.com/charmbracelet/bubbletea" | ||
| "github.com/charmbracelet/glamour" | ||
| "github.com/charmbracelet/lipgloss" | ||
| "github.com/muesli/reflow/wordwrap" | ||
| ) | ||
|
|
||
|
|
@@ -30,11 +31,13 @@ func (m sdkInstructionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| } | ||
|
|
||
| func (m sdkInstructionModel) View() string { | ||
| style := lipgloss.NewStyle().Border(lipgloss.NormalBorder()) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a border around the instructions like in the screenshots. |
||
|
|
||
| return wordwrap.String( | ||
| fmt.Sprintf( | ||
| "Set up your application. Here are the steps to incorporate the LaunchDarkly %s SDK into your code. \n\n%s", | ||
| "Set up your application. Here are the steps to incorporate the LaunchDarkly %s SDK into your code.\n%s", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed an extra newline. |
||
| m.name, | ||
| m.renderMarkdown(), | ||
| style.Render(m.renderMarkdown()), | ||
| ), | ||
| m.width, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,10 +26,8 @@ type sdk struct { | |
| func (s sdk) FilterValue() string { return "" } | ||
|
|
||
| type sdkModel struct { | ||
| choice sdk | ||
| instructions string | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused. |
||
| err error | ||
| list list.Model | ||
| choice sdk | ||
| list list.Model | ||
| } | ||
|
|
||
| const sdkInstructionsFilePath = "internal/setup/sdk_build_instructions/" | ||
|
|
@@ -75,7 +73,11 @@ func NewSdk() tea.Model { | |
| } | ||
|
|
||
| l := list.New(sdksToItems(sdks), sdkDelegate{}, 30, 14) | ||
| l.Title = "Select your SDK." | ||
| l.Title = "Select your SDK:\n" | ||
| // reset title styles | ||
| l.Styles.Title = lipgloss.NewStyle() | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These get default styles set on then from |
||
| l.Styles.TitleBar = lipgloss.NewStyle() | ||
| l.SetShowPagination(true) | ||
| l.SetShowStatusBar(false) | ||
| l.SetFilteringEnabled(false) | ||
| l.Paginator.PerPage = 5 | ||
|
|
@@ -111,7 +113,7 @@ func (m sdkModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| } | ||
|
|
||
| func (m sdkModel) View() string { | ||
| return "\n" + m.list.View() | ||
| return m.list.View() | ||
| } | ||
|
|
||
| type sdkDelegate struct{} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,7 +130,7 @@ func (m WizardModel) View() string { | |
| return fmt.Sprintf("ERROR: %s", m.err) | ||
| } | ||
|
|
||
| return fmt.Sprintf("\nstep %d of %d\n"+m.steps[m.currStep].View(), m.currStep+1, len(m.steps)) | ||
| return fmt.Sprintf("\nStep %d of %d\n"+m.steps[m.currStep].View(), m.currStep+1, len(m.steps)) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capitalized. |
||
| } | ||
|
|
||
| type keyMap struct { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowered the volume on this because there's an exclamation above.