Skip to content

Commit

Permalink
feat(chips): m3 styles
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Aug 11, 2022
1 parent ca982d2 commit 33cc2bc
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 19 deletions.
8 changes: 4 additions & 4 deletions kitchen-sink/react/pages/Chips.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function ChipsPage() {
media={
<img
alt="avatar"
className="h-7 rounded-full"
className="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg"
/>
}
Expand All @@ -64,7 +64,7 @@ export default function ChipsPage() {
media={
<img
alt="avatar"
className="h-7 rounded-full"
className="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg"
/>
}
Expand All @@ -76,7 +76,7 @@ export default function ChipsPage() {
media={
<img
alt="avatar"
className="h-7 rounded-full"
className="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
}
Expand All @@ -101,7 +101,7 @@ export default function ChipsPage() {
media={
<img
alt="avatar"
className="h-7 rounded-full"
className="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
}
Expand Down
8 changes: 4 additions & 4 deletions kitchen-sink/svelte/pages/Chips.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<img
slot="media"
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg"
/>
Jane Doe
Expand All @@ -53,7 +53,7 @@
<img
slot="media"
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg"
/>
John Doe
Expand All @@ -62,7 +62,7 @@
<img
slot="media"
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
Adam Smith
Expand All @@ -86,7 +86,7 @@
<img
slot="media"
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
Adam Smith
Expand Down
8 changes: 4 additions & 4 deletions kitchen-sink/vue/pages/Chips.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg"
/>
</template>
Expand All @@ -40,7 +40,7 @@
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg"
/>
</template>
Expand All @@ -50,7 +50,7 @@
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
</template>
Expand All @@ -67,7 +67,7 @@
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
</template>
Expand Down
17 changes: 13 additions & 4 deletions src/shared/classes/ChipClasses.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { cls } from '../cls.js';

export const ChipClasses = (props, colors) => {
return {
base: {
common: `${colors.text} text-sm inline-flex items-center justify-center align-middle rounded-full px-3`,
common: `text-sm inline-flex items-center justify-center align-middle rounded-full px-3`,
ios: 'rounded-full h-7',
material: 'rounded-lg h-8',
fill: `${colors.bg}`,
outline: `border ${colors.border}`,
material: 'rounded-lg h-8 font-medium',
fill: {
ios: cls(colors.fillBgIos, colors.fillTextIos),
material: cls(colors.fillBgMaterial, colors.fillTextMaterial),
},
outline: {
common: `border`,
ios: cls(colors.outlineTextIos, colors.outlineBorderIos),
material: cls(colors.outlineTextMaterial, colors.outlineBorderMaterial),
},
},
media: {
common: '-my-1 mr-1 select-none',
Expand Down
26 changes: 23 additions & 3 deletions src/shared/colors/ChipColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,32 @@ import { cls } from '../cls.js';

export const ChipColors = (colorsProp = {}, dark) => {
return {
bg: cls(`bg-black bg-opacity-10`, dark('dark:bg-white dark:bg-opacity-10')),
text: 'text-current',
border: cls(
fillTextIos: 'text-current',
fillTextMaterial: cls(
'text-md-light-on-secondary-container',
dark('dark:text-md-dark-on-secondary-container')
),
fillBgIos: cls(
`bg-black bg-opacity-10`,
dark('dark:bg-white dark:bg-opacity-10')
),
fillBgMaterial: cls(
'bg-md-light-secondary-container',
dark('dark:bg-md-dark-secondary-container')
),
outlineTextIos: cls('text-current'),
outlineTextMaterial: cls(
'text-md-light-on-surface',
dark('dark:text-md-dark-on-surface')
),
outlineBorderIos: cls(
`border-black border-opacity-20`,
dark('dark:border-white dark:border-opacity-20')
),
outlineBorderMaterial: cls(
`border-md-light-outline`,
dark('dark:border-md-dark-outline')
),
...colorsProp,
};
};

0 comments on commit 33cc2bc

Please sign in to comment.