Skip to content

Commit

Permalink
feat: improve design of Accordion,Alert,Avatar,Breadcrumb, Button, an…
Browse files Browse the repository at this point in the history
…d Pagination components
  • Loading branch information
HamzaAmar committed Aug 3, 2024
1 parent 792992b commit cfcb47d
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 39 deletions.
4 changes: 2 additions & 2 deletions apps/stories/stories/alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ export const AlertCorner = () => {
)
}

const Variants = ['solid', 'outline', 'soft', 'mixed']
const Variants = ['shadow', 'solid', 'outline', 'soft', 'mixed']

export const AlertVariant = () => {
return (
<div className="l_flow__md">
{Variants.map((variant) => (
<Flex key={variant} direction="column" gap="sm">
<AlertBase variant={variant} color="danger" />
<AlertBase variant={variant} color="warning" />
</Flex>
))}
</div>
Expand Down
18 changes: 11 additions & 7 deletions apps/stories/stories/pagination.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ const meta: Meta<typeof Pagination> = {
title: 'Components/Pagination',
component: Pagination,
}

export function PaginationDefault() {
return (
<div>
<Pagination count={10} />
</div>
)
}
export default meta
export function PaginationColor() {
return (
Expand Down Expand Up @@ -46,13 +52,11 @@ export function PaginationColor() {
export function PaginationVariant() {
return (
<div className="l_flow__md">
<Pagination count={10} />
<Pagination count={10} color="danger" />
<Pagination count={10} color="success" />
<Pagination count={10} color="warning" />
<Pagination count={10} color="primary" />
<Pagination count={10} color="secondary" />
<Pagination count={10} color="bg" />
<Pagination count={10} color="primary" variant="mixed" />
<Pagination count={10} color="primary" variant="soft" />
<Pagination count={10} color="primary" variant="solid" />
<Pagination count={10} color="primary" variant="text" />
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pillar-core/src/core/accordion/_accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
width: 100%;
text-align: start;
background-color: transparent;
padding: 0.75em 0.5em;
padding: 0.5em;
color: currentColor;
transform: none;

Expand Down
12 changes: 9 additions & 3 deletions packages/pillar-core/src/core/alert/_alert.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
unavailable, these properties take priority. However, if specific props related to
avatars are provided, they will override these properties.
*/
border-radius: var(--alert-rad, 0.25em);
border-radius: var(--alert-rad, 0);
font-size: var(--alert-size, 1rem);

&.u_solid {
border-inline-start: 6px solid var(--opa-8);
&.u_solid,
&.u_soft {
border-inline-start: 3px solid var(--opa-8);
}

&.u_soft {
border-inline-color: var(--clr-9);
}
}

Expand All @@ -27,6 +32,7 @@
*/

.a-l_cnt {
font-size: 0.925em;
&[data-inline='true'] {
gap: var(--s-xs);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/pillar-core/src/core/alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Alert = forwardRef((props, forwardedRef) => {
size,
title,
inline,
variant = 'solid',
variant = 'soft',
closable = false,
corner,
className,
Expand Down Expand Up @@ -51,7 +51,7 @@ export const Alert = forwardRef((props, forwardedRef) => {
[`u_f-${size}`]: !!size,
})

const _title = title && <div className="u_transform__capitalize u_leading__md u_f-medium">{title}</div>
const _title = title && <div className="u_t__capitalize u_leading__md u_f-medium">{title}</div>
const _message = message && <span>{message}</span>

const closeIcon = closable && (
Expand Down
4 changes: 2 additions & 2 deletions packages/pillar-core/src/core/avatar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @next/next/no-img-element */
import { Children, forwardRef, useState } from 'react'
import { User } from '@pillar-ui/icons'
import { Photos } from '@pillar-ui/icons'
import type { AvatarGroupContextProps, AvatarGroupProps, AvatarProps } from './avatar.type'
import { classnames, createContext } from '@pillar-ui/utils'
import { ForwardRefComponent } from '../../types/polymorphic.type'
Expand Down Expand Up @@ -66,7 +66,7 @@ export const Avatar = forwardRef((props, forwardRef) => {
size = ctx?.size,
corner = ctx?.corner,
color = ctx?.color ?? 'primary',
fallback = ctx?.fallback ?? <User width="max(1.75em, 10px)" />,
fallback = ctx?.fallback ?? <Photos strokeWidth="1.5" width="max(1.5em, 10px)" />,
image = '',
className,
title,
Expand Down
10 changes: 6 additions & 4 deletions packages/pillar-core/src/core/breadcrumb/_breadcrumb.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

.b-r {
font-size: 0;
& ol {
margin: 0;
padding: 0;
Expand All @@ -27,15 +28,16 @@

.b-r_lnk {
min-width: 1.5rem;
font-size: 1em;
font-size: 0.875em;
color: var(--clr-11);
padding: 0;
text-transform: capitalize;
&:hover {
text-decoration: underline 2px;
color: var(--clr-10);
text-decoration: underline 1.2px;
}
&[aria-current='page'] {
color: var(--bg-11);
color: var(--bg-10);
text-decoration: none;
cursor: not-allowed;
}
}
4 changes: 2 additions & 2 deletions packages/pillar-core/src/core/breadcrumb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const [BreadcrumbProvider, useBreadcrumbContext] = createContext<BreadcrumbConte
})

export const BreadcrumbItem = forwardRef((props, forwardedRef) => {
const { separator: contextSeparator = '>' } = useBreadcrumbContext() ?? {}
const { separator: contextSeparator = '/' } = useBreadcrumbContext() ?? {}
const { as = 'a', children, current, separator = contextSeparator, className, ...rest } = props
const currentPage: CurrentPage = current ? { 'aria-current': 'page' } : {}
const classNames = classnames(`b-r_lnk`, { [className!]: !!className })
Expand Down Expand Up @@ -45,7 +45,7 @@ BreadcrumbItem.displayName = 'BreadcrumbItem'
*/

export const Breadcrumb = forwardRef((props, ref) => {
const { children, separator, size, color = 'primary', className, as: Tag = 'nav', ...rest } = props
const { children, separator, size, color = 'bg', className, as: Tag = 'nav', ...rest } = props
const breadcrumbContext = { separator }
const classNames = classnames(`u_${color}`, {
[`u_f-${size}`]: !!size,
Expand Down
2 changes: 1 addition & 1 deletion packages/pillar-core/src/core/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const IconButton = forwardRef(
},
forwardedRef
) => {
const iconButtonClassName = classnames(`bu-i b_u u_${variant} u_${color} u_center`, {
const iconButtonClassName = classnames(`b_u bu-i u_${variant} u_${color} u_center`, {
[className!]: !!className,
[`u_f-${size}`]: !!size,
[`u_rad-${corner}`]: !!corner,
Expand Down
2 changes: 1 addition & 1 deletion packages/pillar-core/src/core/code/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ForwardRefComponent } from '../../types/polymorphic.type'
import { classnames } from '@pillar-ui/utils'

export const Code = forwardRef((props, ref) => {
const { as: Tag = 'code', color = 'bg', size = 'md', corner, children, transform, className, ...rest } = props
const { as: Tag = 'code', color = 'bg', size = 'sm', corner, children, transform, className, ...rest } = props

const classNames = classnames(`c-o u_soft u_${color} `, {
[`u_f-${size}`]: !!size,
Expand Down
19 changes: 8 additions & 11 deletions packages/pillar-core/src/core/pagination/_pagination.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.p-a_btn {
padding: 0.5rem;
padding: 0.25rem;
aspect-ratio: 1 / 1;
min-width: 2em;
color: var(--clr-12);
line-height: 1;
overflow: hidden;
/* overflow: hidden; */

&[aria-current='page'] {
background-color: var(--clr-9);
color: white;
border-color: var(--opa-8);
outline: 2.5px solid var(--clr-9);
outline-offset: -2px;
&.u_solid {
outline-color: var(--clr-12);
}
}
}

Expand All @@ -27,9 +30,3 @@
gap: var(--s-sm);
list-style: none;
}

@media (forced-colors: active) {
.p-a_bu[aria-current='page'] {
background-color: Highlight;
}
}
2 changes: 1 addition & 1 deletion packages/pillar-core/src/core/pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Item = forwardRef((props, forwardedRef) => {
children,
variant = context?.variant ?? 'outline',
color = context?.color ?? 'bg',
size = context?.size ?? 'md',
size = context?.size ?? 'sm',
corner = context?.corner ?? 'sm',
number,
className,
Expand Down
2 changes: 1 addition & 1 deletion packages/pillar-core/src/core/switch/_switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
width: calc(1.25em - 2px);
height: calc(1.25em - 4px);
border-radius: inherit;
background-color: var(--bg-2);
background-color: var(--bg-1);
position: absolute;
inset-inline-start: 0;
top: 50%;
Expand Down
2 changes: 1 addition & 1 deletion packages/pillar-core/src/css/utilities/_variants.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

.u_mixed {
border-color: var(--clr-7);
border-color: var(--clr-8);
background-color: var(--clr-3);
}

Expand Down

0 comments on commit cfcb47d

Please sign in to comment.