Skip to content

Commit

Permalink
Updates for Mint 0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed May 24, 2023
1 parent 892cef9 commit 5655d69
Show file tree
Hide file tree
Showing 32 changed files with 171 additions and 212 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Mint
uses: fabasoad/setup-mint-action@main
with:
version: 0.17.0
version: 0.18.0

- name: Install dependencies
run: mint install
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mint 0.16.0
mint 0.18.0
4 changes: 2 additions & 2 deletions mint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mint-ui-website",
"mint-version": "0.16.0 <= v < 1.0.0",
"mint-version": "0.18.0 <= v < 1.0.0",
"application": {
"name": "Mint UI",
"title": "Mint UI - Beautiful, Reliable Components for Mint",
Expand All @@ -26,7 +26,7 @@
"dependencies": {
"mint-ui": {
"repository": "https://github.com/mint-lang/mint-ui",
"constraint": "6.0.0 <= v < 7.0.0"
"constraint": "7.0.0 <= v < 8.0.0"
}
}
}
2 changes: 1 addition & 1 deletion source/Components/DocBox.mint
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ component DocBox {

fun render {
<div>
if (String.isNotBlank(title)) {
if String.isNotBlank(title) {
<a::anchor
name={String.parameterize(title)}
aria-hidden="true">
Expand Down
2 changes: 1 addition & 1 deletion source/Components/Example.mint
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ component Example {
}

let warning =
if (controlled) {
if controlled {
<div::warning>
<Ui.Icon icon={Ui.Icons:ALERT}/>
</div>
Expand Down
6 changes: 3 additions & 3 deletions source/Components/Header.mint
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ component Header {
connect Ui exposing { mobile, darkMode, toggleDarkMode }

get darkModeToggle : Ui.NavItem {
if (mobile) {
if mobile {
let label =
if (darkMode) {
if darkMode {
"Light Mode"
} else {
"Dark Mode"
}

let iconBefore =
if (darkMode) {
if darkMode {
Ui.Icons:SUN
} else {
Ui.Icons:MOON
Expand Down
30 changes: 15 additions & 15 deletions source/Components/Hljs.mint
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ component Hljs {
}

get highlightedCode {
if (language == "plain") {
if language == "plain" {
String.split(code, "\n")
} else {
`hljs.highlight(#{language}, #{code}, true).value`
Expand All @@ -25,7 +25,7 @@ component Hljs {
let nextContent =
highlightedCode

if (nextContent != content) {
if nextContent != content {
next { content: nextContent }
} else {
`null`
Expand Down Expand Up @@ -53,7 +53,7 @@ component Hljs {
padding: 0.5em 1em;
display: flex;

if (open) {
if open {
border-bottom: 1px solid var(--content-border);
}

Expand Down Expand Up @@ -101,13 +101,13 @@ component Hljs {
style line (highlighted : Bool) {
counter-increment: line-number;

if (highlighted && darkMode) {
if highlighted && darkMode {
background: #2C2C2C;
} else if (highlighted && !darkMode) {
} else if highlighted && !darkMode {
background: #F9F9F9;
}

if (highlighted) {
if highlighted {
line-height: 1.6;
opacity: 1;
} else {
Expand All @@ -125,9 +125,9 @@ component Hljs {
text-align: right;
color: #999;

if (highlighted && darkMode) {
if highlighted && darkMode {
border-right-color: #222;
} else if (highlighted) {
} else if highlighted {
border-right-color: #DDD;
} else {
border-right-color: var(--title-border);
Expand All @@ -144,7 +144,7 @@ component Hljs {
color: #999;
margin: 0;

if (Array.isEmpty(highlight)) {
if Array.isEmpty(highlight) {
--unhighlighted-opacity: 1;
} else {
--highlighted-background: #EEE;
Expand All @@ -154,7 +154,7 @@ component Hljs {
.hljs-doctag,
.hljs-keyword,
.hljs-formula {
if (darkMode) {
if darkMode {
color: #d959ff;
} else {
color: #bc35e3;
Expand All @@ -169,7 +169,7 @@ component Hljs {
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-number {
if (darkMode) {
if darkMode {
color: #59AFF2;
} else {
color: #1D8FE8;
Expand All @@ -181,7 +181,7 @@ component Hljs {
.hljs-addition,
.hljs-attribute,
.hljs-meta-string {
if (darkMode) {
if darkMode {
color: #1CCE3A;
} else {
color: #26AE3D;
Expand All @@ -195,7 +195,7 @@ component Hljs {
.hljs-subst {
font-weight: bold;

if (darkMode) {
if darkMode {
color: #F4D352;
} else {
color: #D5841C;
Expand All @@ -210,7 +210,7 @@ component Hljs {
<div::icon-label(0.25)>
<Ui.Icon
icon={
if (open) {
if open {
Ui.Icons:CHEVRON_DOWN
} else {
Ui.Icons:CHEVRON_RIGHT
Expand All @@ -237,7 +237,7 @@ component Hljs {
</button>
</div>

if (open) {
if open {
<pre::pre>
<{
Array.mapWithIndex(
Expand Down
12 changes: 6 additions & 6 deletions source/Components/PropertiesTable.mint
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ component PropertiesTable {
}

fun render : Html {
case (decode documentation as Documentation) {
case decode documentation as Documentation {
Result::Ok(decoded) =>
if (Array.isEmpty(decoded.properties)) {
if Array.isEmpty(decoded.properties) {
<></>
} else {
let sorted =
Expand All @@ -30,14 +30,14 @@ component PropertiesTable {
})

let rows =
for (prop of sorted) {
for prop of sorted {
{
prop.name, [
Ui.Cell::Html(
<div::name>
<{ prop.name }>
</div>),
case (prop.description) {
case prop.description {
Maybe::Just(value) =>
Ui.Cell::Html(
<div::description>
Expand All @@ -49,13 +49,13 @@ component PropertiesTable {

Maybe::Nothing => Ui.Cell::String("")
},
case (prop.type) {
case prop.type {
Maybe::Just(value) =>
Ui.Cell::Code(code: value, breakSpaces: true)

Maybe::Nothing => Ui.Cell::String("")
},
case (prop.default) {
case prop.default {
Maybe::Just(value) => Ui.Cell::Code(code: value, breakSpaces: false)
Maybe::Nothing => Ui.Cell::String("")
}
Expand Down
4 changes: 2 additions & 2 deletions source/Documentation/AdaptingToScreenSize.mint
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ component Documentation.AdaptingToScreenSize {
connect Ui exposing { mobile }

fun render : Html {
if (mobile) {
if mobile {
<div>"MOBILE"</div>
} else {
<div>"DESKTOP"</div>
Expand Down Expand Up @@ -69,7 +69,7 @@ component Documentation.AdaptingToScreenSize {

fun render : Html {
<div as base>
if (width < 700) {
if width < 700 {
<div>"MOBILE"</div>
} else if (width < 1100) {
<div>"TABLET"</div>
Expand Down
12 changes: 6 additions & 6 deletions source/Documentation/Theming.mint
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ component Documentation.Theming {
}
]
rows={
for (token of DEFAULT_TOKENS) {
case (token) {
for token of DEFAULT_TOKENS {
case token {
Ui.Token::Simple(name, value) =>
Maybe::Just(
{
Expand Down Expand Up @@ -137,8 +137,8 @@ component Documentation.Theming {
}
]
rows={
for (token of DEFAULT_TOKENS) {
case (token) {
for token of DEFAULT_TOKENS {
case token {
Ui.Token::Schemed(name, light, dark) =>
Maybe::Just(
{
Expand Down Expand Up @@ -173,8 +173,8 @@ component Documentation.Theming {
}
]
rows={
for (token of DEFAULT_TOKENS) {
case (token) {
for token of DEFAULT_TOKENS {
case token {
Ui.Token::Schemed(name, dark) =>
Maybe::Just(
{
Expand Down
4 changes: 1 addition & 3 deletions source/Examples/Checkout.mint
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ component Examples.Checkout {

await next { errors: errors }

if (Map.isEmpty(errors)) {
if Map.isEmpty(errors) {
Ui.Notifications.notifyDefault(<{ "Thanks for filling in the data..." }>)
} else {
next { }
}
}

Expand Down
4 changes: 1 addition & 3 deletions source/Examples/#.mint
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ component Examples.Login {

await next { errors: errors }

if (Map.isEmpty(errors)) {
if Map.isEmpty(errors) {
Ui.Notifications.notifyDefault(<{ "You are now logged in 👋" }>)
Window.navigate("/examples/dashboard")
} else {
next { }
}
}

Expand Down
4 changes: 1 addition & 3 deletions source/Examples/RecoverPassword.mint
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ component Examples.RecoverPassword {

await next { errors: errors }

if (Map.isEmpty(errors)) {
if Map.isEmpty(errors) {
Ui.Notifications.notifyDefault(<{ "An email would have been sent here...📭" }>)
Window.navigate("/examples")
} else {
next { }
}
}

Expand Down
4 changes: 1 addition & 3 deletions source/Examples/Register.mint
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ component Examples.Register {

await next { errors: errors }

if (Map.isEmpty(errors)) {
if Map.isEmpty(errors) {
Ui.Notifications.notifyDefault(<{ "You are now registered and logged in 👋" }>)
Window.navigate("/examples/dashboard")
} else {
next { }
}
}

Expand Down
4 changes: 2 additions & 2 deletions source/Examples/UserList.mint
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ component Examples.UserList {
USERS
|> Array.sortBy(
(user : Tuple(String, String, Number, String)) {
case (sortBy) {
case sortBy {
"age" => Number.toString(user[2])
"address" => user[3]
"email" => user[1]
Expand All @@ -79,7 +79,7 @@ component Examples.UserList {
|> Array.slice(page * 10, (page + 1) * 10)

let rows =
for (user of processedUsers) {
for user of processedUsers {
{
user[0],
[
Expand Down
30 changes: 14 additions & 16 deletions source/Main.mint
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ component Main {
}

get content {
case (page) {
case page {
Page::Example(item) => <{ "This branch is handled one level up!" }>
Page::NotFound => <Page.NotFound/>
Page::Examples => <Page.Examples/>
Expand Down Expand Up @@ -49,22 +49,20 @@ component Main {
fontConfiguration={Ui:DEFAULT_FONT_CONFIGURATION}
tokens={Ui:DEFAULT_TOKENS}>

case (page) {
Page::Example(name, item) =>
<div::example>
<{ item }>
</div>

=>
<>
<Ui.ScrollToTop/>
if let Page::Example(name, item) = page {
<div::example>
<{ item }>
</div>
} else {
<>
<Ui.ScrollToTop/>

<Ui.Layout.Website
content={content}
maxWidth="100vw"
footer={<Footer/>}
header={<Header/>}/>
</>
<Ui.Layout.Website
footer={<Footer/>}
header={<Header/>}
content={content}
maxWidth="100vw"/>
</>
}

</Ui.Theme.Root>
Expand Down
Loading

0 comments on commit 5655d69

Please # to comment.