Skip to content

Commit

Permalink
feat(block-title): tweak styles to match material 3
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Aug 5, 2022
1 parent 48c05d9 commit 63b6b7a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
13 changes: 12 additions & 1 deletion src/react/components/BlockTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const BlockTitle = forwardRef((props, ref) => {
const {
component = 'div',
className,
colors: colorsProp,

withBlock = true,

ios,
Expand All @@ -32,7 +34,16 @@ const BlockTitle = forwardRef((props, ref) => {

const themeClasses = useThemeClasses({ ios, material });

const c = themeClasses(BlockTitleClasses({ ...props, withBlock }), className);
const colors = {
textIos: '',
textMaterial: 'text-primary',
...colorsProp,
};

const c = themeClasses(
BlockTitleClasses({ ...props, withBlock }, colors),
className
);

return (
<Component ref={elRef} className={c.base} {...attrs}>
Expand Down
6 changes: 3 additions & 3 deletions src/shared/classes/BlockTitleClasses.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const BlockTitleClasses = (props) => {
export const BlockTitleClasses = (props, colors) => {
const { withBlock } = props;
return {
base: {
common: `pl-4-safe pr-4-safe mt-8 flex justify-between items-center ${
withBlock ? '-mb-6' : 'mb-2'
}`,
ios: `font-semibold`,
material: `text-sm font-medium text-primary`,
ios: `font-semibold ${colors.textIos}`,
material: `text-sm font-medium ${colors.textMaterial}`,
},
};
};
10 changes: 9 additions & 1 deletion src/svelte/components/BlockTitle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
let className = undefined;
export { className as class };
let colorsProp = undefined;
export { colorsProp as colors };
export let ios = undefined;
export let material = undefined;
export let withBlock = true;
$: colors = {
textIos: '',
textMaterial: 'text-primary',
...colorsProp,
};
$: c = useThemeClasses(
{ ios, material },
BlockTitleClasses({ withBlock }),
BlockTitleClasses({ withBlock }, colors),
className,
(v) => (c = v)
);
Expand Down
11 changes: 10 additions & 1 deletion src/vue/components/BlockTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</component>
</template>
<script>
import { computed } from 'vue';
import { BlockTitleClasses } from '../../shared/classes/BlockTitleClasses.js';
import { useThemeClasses } from '../shared/use-theme-classes.js';
Expand All @@ -14,6 +15,9 @@
type: String,
default: 'span',
},
colors: {
type: Object,
},
ios: {
type: Boolean,
default: undefined,
Expand All @@ -28,7 +32,12 @@
},
},
setup(props) {
const c = useThemeClasses(props, () => BlockTitleClasses(props));
const colors = computed(() => ({
textIos: '',
textMaterial: 'text-primary',
...(props.colors || {}),
}));
const c = useThemeClasses(props, () => BlockTitleClasses(props, colors));
return {
c,
};
Expand Down

0 comments on commit 63b6b7a

Please sign in to comment.