Compare commits

..

3 commits

5 changed files with 270 additions and 31 deletions

View file

@ -1,22 +1,223 @@
@use '/src/styles/variables.sass' as vars @use '/src/styles/variables.sass' as vars
@use '/src/styles/fonts.sass' as fonts
@use 'sass:color' @use 'sass:color'
$bulmaPrimary: rgb(0, 235, 199)
$bulmaPrimaryText: rgb(0, 31, 26)
$bulmaLink: rgb(92, 111, 255)
$bulmaLinkText: rgb(245, 246, 255)
$bulmaInfo: rgb(128, 217, 255)
$bulmaInfoText: rgb(0, 36, 51)
$bulmaSuccess: rgb(91, 205, 154)
$bulmaSuccessText: rgb(10, 31, 21)
$bulmaWarning: rgb(255, 191, 41)
$bulmaWarningText: rgb(41, 29, 0)
$bulmaDanger: rgb(255, 128, 153)
$bulmaDangerText: rgb(26, 0, 5)
$bulmaLight: rgb(255, 255, 255)
$bulmaLightText: rgb(46, 51, 61)
$bulmaDark: rgb(57, 63, 76)
$bulmaDarkText: rgb(243, 244, 246)
$bulmaText: rgb(31, 34, 41)
$bulmaTextText: rgb(235, 236, 240)
$bulmaGhost: rgba(0,0,0,0)
$bulmaGhostText: rgb(66, 88, 255)
$bootstrapTextLight: rgb(255, 255, 253)
$bootstrapTextDark: rgb(0, 0, 2)
$bootstrapTextLink: rgb(139, 185, 254)
$bootstrapPrimary: rgb(13, 110, 253)
$bootstrapSecondary: rgb(92, 99, 106)
$bootstrapSuccess: rgb(21, 115, 71)
$bootstrapDanger: rgb(187, 45, 59)
$bootstrapWarning: rgb(255, 202, 44)
$bootstrapInfo: rgb(49, 210, 242)
$bootstrapLight: rgb(211, 212, 213)
$bootstrapDark: rgb(33, 37, 41)
.button .button
background: vars.$primaryColor background-color: vars.$primaryColor
border: none border: none
border-radius: 32px
color: white color: white
padding: 0.5rem 1.25rem padding: 0.5rem 1.25rem
text-align: center text-align: center
text-decoration: none text-decoration: none
display: inline-block display: inline-block
font-size: 0.75rem font-size: 1rem
font-weight: 700 font-weight: 500
cursor: pointer cursor: pointer
transition: all 0.2s ease-out transition: all 0.2s ease-out
&:hover &:hover
background: color.adjust(vars.$primaryColor, $blackness: 20%) background-color: color.adjust(vars.$primaryColor, $blackness: 20%)
&:active &:active
transform: scale(0.95) transform: scale(0.95)
.bu-primary
@extend .button
font-family: fonts.$Inter
background-color: $bulmaPrimary
color: $bulmaPrimaryText
border: none
font-size: 1rem
border-radius: 0.375rem
font-weight: 500
padding: 0.5rem 1.25rem
height: 2.5rem
&:hover
background-color: color.adjust($bulmaPrimary, $lightness: 10%)
.bu-link
@extend .bu-primary
background-color: $bulmaLink
color: $bulmaLinkText
&:hover
background-color: color.adjust($bulmaLink, $lightness: 5%)
.bu-info
@extend .bu-primary
background-color: $bulmaInfo
color: $bulmaInfoText
&:hover
background-color: color.adjust($bulmaInfo, $lightness: 5%)
.bu-success
@extend .bu-primary
background-color: $bulmaSuccess
color: $bulmaSuccessText
&:hover
background-color: color.adjust($bulmaSuccess, $lightness: 5%)
.bu-warning
@extend .bu-primary
background-color: $bulmaWarning
color: $bulmaWarningText
&:hover
background-color: color.adjust($bulmaWarning, $lightness: 5%)
.bu-danger
@extend .bu-primary
background-color: $bulmaDanger
color: $bulmaDangerText
&:hover
background-color: color.adjust($bulmaDanger, $lightness: 5%)
.bu-light
@extend .bu-primary
background-color: $bulmaLight
color: $bulmaLightText
&:hover
background-color: color.adjust($bulmaLight, $lightness: 5%)
.bu-dark
@extend .bu-primary
background-color: $bulmaDark
color: $bulmaDarkText
&:hover
background-color: color.adjust($bulmaDark, $lightness: 5%)
.bu-text
@extend .bu-primary
background-color: rgba(0,0,0,0)
color: $bulmaTextText
text-decoration: underline
&:hover
background-color: hsl(221,14%,14%)
.bu-ghost
@extend .bu-primary
background-color: $bulmaGhost
color: $bulmaGhostText
&:hover
background-color: transparent
text-decoration: underline
.bo-primary
@extend .button
font-family: 'Segoe UI', fonts.$Roboto
background-color: $bootstrapPrimary
color: $bootstrapTextLight
border: none
font-size: 1rem
border-radius: 0.375rem
font-weight: 400
padding: 0.5rem 1.25rem
height: 2.5rem
margin: 0.25rem 0.125rem
&:hover
background-color: color.adjust($bootstrapPrimary, $blackness: 10%)
.bo-secondary
@extend .bo-primary
background-color: $bootstrapSecondary
&:hover
background-color: color.adjust($bootstrapSecondary, $blackness: 10%)
.bo-success
@extend .bo-primary
background-color: $bootstrapSuccess
&:hover
background-color: color.adjust($bootstrapSuccess, $blackness: 10%)
.bo-danger
@extend .bo-primary
background-color: $bootstrapDanger
&:hover
background-color: color.adjust($bootstrapDanger, $blackness: 10%)
.bo-warning
@extend .bo-primary
background-color: $bootstrapWarning
color: $bootstrapTextDark
&:hover
background-color: color.adjust($bootstrapWarning, $lightness: 5%)
.bo-info
@extend .bo-primary
background-color: $bootstrapInfo
color: $bootstrapTextDark
&:hover
background-color: color.adjust($bootstrapInfo, $lightness: 5%)
.bo-light
@extend .bo-primary
background-color: $bootstrapLight
color: $bootstrapTextDark
&:hover
background-color: color.adjust($bootstrapLight, $blackness: 10%)
.bo-dark
@extend .bo-primary
background-color: $bootstrapDark
// color: $bootstrapTextDark
&:hover
background-color: color.adjust($bootstrapDark, $lightness: 10%)
.bo-link
@extend .bo-primary
background-color: transparent
color: $bootstrapTextLink
text-decoration: underline
&:hover
color: color.adjust($bootstrapTextLink, $lightness: 5%)
background-color: transparent

View file

@ -1,25 +1,65 @@
import { boolean } from 'astro:schema'
import './Button.sass' import './Button.sass'
import { Show } from 'solid-js' import { Show, Switch, Match } from 'solid-js'
interface Props { interface Props {
label?: string label?: string
to?: string to?: string
onClick?: () => void onClick?: () => void
edges?: 'curved' | 'rounded' | 'flat'
design?: 'bu-primary' | 'bu-link' | 'bu-info' | 'bu-success' | 'bu-warning' | 'bu-danger' | 'bu-dark' | 'bu-light' | 'bu-text' | 'bu-ghost' | 'bo-primary' | 'bo-secondary' | 'bo-success' | 'bo-danger' | 'bo-warning' | 'bo-info' | 'bo-light' | 'bo-dark' | 'bo-link'
}
const getBorderRadius = (edge: Props['edges']) => {
switch (edge) {
case 'curved':
return 'border-radius: 6px'
case 'rounded':
return 'border-radius: 32px'
case 'flat':
return 'border-radius: 0'
default:
return 'border-radius: 0'
}
} }
export default (props: Props) => { export default (props: Props) => {
const borderRadius = getBorderRadius(props.edges)
return ( return (
<> <>
<Show when={props.to}> <Show when={props.to}>
<a href={props.to} aria-label={props.label}> <Switch>
<button class="button">{props.label || 'Click Me!'}</button> <Match when={props.design}>
</a> <a href={props.to} aria-label={props.label}>
<button class={props.design} style={borderRadius}>
{props.label || 'Click Me!'}
</button>
</a>
</Match>
<Match when={!props.design}>
<a href={props.to} aria-label={props.label}>
<button class="button" style={borderRadius}>
{props.label || 'Click Me!'}
</button>
</a>
</Match>
</Switch>
</Show> </Show>
<Show when={!props.to}> <Show when={!props.to}>
<button class="button" onClick={props.onClick}> <Switch>
{props.label || 'Click Me!'} <Match when={props.design}>
</button> <button class={props.design} onClick={props.onClick} style={borderRadius}>
{props.label || 'Click Me!'}
</button>
</Match>
<Match when={!props.design}>
<button class="button" onClick={props.onClick} style={borderRadius}>
{props.label || 'Click Me!'}
</button>
</Match>
</Switch>
</Show> </Show>
</> </>
) )

View file

@ -27,7 +27,7 @@ export default (props: Props) => {
return ( return (
<> <>
<picture > <picture>
<source srcset={imageSrc().replace(/\.webp$/, '.avif')} type="image/avif" /> <source srcset={imageSrc().replace(/\.webp$/, '.avif')} type="image/avif" />
<source srcset={imageSrc()} type="image/webp" /> <source srcset={imageSrc()} type="image/webp" />
<img src={imageSrc()} width={props.size} height="auto" decoding="async" loading="lazy" alt={props.alt} /> <img src={imageSrc()} width={props.size} height="auto" decoding="async" loading="lazy" alt={props.alt} />

View file

@ -3,29 +3,23 @@ import Layout from '../layouts/Layout.astro'
import Button from '../builtin-components/Button/Button.tsx' import Button from '../builtin-components/Button/Button.tsx'
import Image from '../builtin-components/Image/Image' import Image from '../builtin-components/Image/Image'
import Link from '../builtin-components/Link/Link' import Link from '../builtin-components/Link/Link'
import Counter from '../components/Counter.tsx' import Counter from '../components/Counter/Counter.tsx'
import Page from '../builtin-components/Page/Page'
--- ---
<Layout title="FWT"> <Layout title="FWT">
<main class="page"> <Page alignment="column">
<Link to="https://git.patalcala.com/patalcala9/fwt"> <Link to="https://git.patalcala.com/patalcala9/fwt">
<Image src="fwt.png" size={250} /> <Image src="fwt.png" size={250} />
</Link> </Link>
<h1>Fast WebApp Template</h1> <h1>Fast WebApp Template</h1>
<Counter client:load/> <Counter client:load />
<Button label="Next Page" to="/next" /> <Button edges="rounded" label="Show Built-in Components" to="/next" />
</main> </Page>
<style lang="sass"> <style lang="sass">
.page h1
display: flex color: #3377AC
flex-direction: column
flex-wrap: wrap
justify-content: center
align-items: center
align-content: center
margin: 2rem
height: 90vh
</style> </style>
</Layout> </Layout>

View file

@ -2,17 +2,21 @@
import Layout from '../layouts/Layout.astro' import Layout from '../layouts/Layout.astro'
import Button from '../builtin-components/Button/Button.tsx' import Button from '../builtin-components/Button/Button.tsx'
import Image from '../builtin-components/Image/Image' import Image from '../builtin-components/Image/Image'
import Page from '../builtin-components/Page/Page'
--- ---
<Layout title="Home"> <Layout title="Home">
<main class="page"> <Page alignment='column'>
<h1>Second Page</h1> <h1>Built-in Components</h1>
<Button label="Back to Home" to="/" /> <Button edges='rounded' label="Back to Home" to="/" />
<section class="image"> <section class="image">
<Image src="sample.png" alt="Example Image" size={400} /> <Image src="sample.png" alt="Example Image" size={400} />
<Image src="sample.png" alt="Example Image" size={400} />
<Image src="sample.png" alt="Example Image" size={400} />
<Image src="sample.png" alt="Example Image" size={400} />
</section> </section>
</main> </Page>
</Layout> </Layout>
<style lang="sass"> <style lang="sass">