Skip to content
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

feat: consola.box #193

Merged
merged 14 commits into from Jun 27, 2023
Merged

feat: consola.box #193

merged 14 commits into from Jun 27, 2023

Conversation

cpreston321
Copy link
Member

@cpreston321 cpreston321 commented Jun 2, 2023

Context

Reference: unjs/citty#21

In this PR I will introduce a new util function for creating a box kinda like boxen but without deps! This was initially created for unjs/citty but now moved to consola. Thanks @pi0 for the idea.

The functionality is less than boxen but will get the job done for now and we make it better eventually!

  • Border presets includes: solid, double, double-single, double-single-rounded, single-thick, single-double, single-double-rounded & rounded.
  • Implements colorette to style the border while dynamically importing it to style it.
// API
await consola.banner("You have an update!", {
  title: "Update available!",
  padding: 2,
  valign: 'center',
  border: {
    color: "yellow",
    style: "rounded",
  },
})

Preview:

image

Thanks,
CP 🚀

@cpreston321 cpreston321 requested a review from pi0 June 2, 2023 02:02
@cpreston321 cpreston321 changed the title feat: box util function feat: box / banner util function Jun 2, 2023
@cpreston321 cpreston321 changed the title feat: box / banner util function feat: add box / banner Jun 2, 2023
@cpreston321 cpreston321 changed the title feat: add box / banner feat: add banner Jun 2, 2023
@cpreston321 cpreston321 marked this pull request as ready for review June 2, 2023 02:41
@pi0 pi0 changed the title feat: add banner feat: consola.box log type Jun 27, 2023
@pi0 pi0 changed the title feat: consola.box log type feat: consola.box Jun 27, 2023
@pi0
Copy link
Member

pi0 commented Jun 27, 2023

Thanks! I have made few refactors:

  • Rename banner to box to keep consistent with utility name (we can add an alias too for consola.banner!)
  • It is a utility + log type so that all loggers get box logs but fancy reporter uses the util
  • Few refactors

@pi0 pi0 merged commit 45ed7f1 into main Jun 27, 2023
1 check passed
h: "─",
v: "║",
},
SingleThick: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be camel cased? @pi0 ?

@cpreston321
Copy link
Member Author

Thanks @pi0! I can't wait to use this!

@pi0 pi0 deleted the feat/box branch June 27, 2023 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants