Skip to content

Commit

Permalink
fix(CardGrid): item css
Browse files Browse the repository at this point in the history
  • Loading branch information
crlang committed Jan 12, 2022
1 parent 5a74163 commit 19e50a0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
41 changes: 41 additions & 0 deletions src/components/CardGrid/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@use 'sass:math';

$prefix-cls: '#{$namespace}-card-grid';

.#{$prefix-cls} {
overflow: visible;

&__container {
@for $i from 1 through 20 {
&.row-span#{$i} > .#{$prefix-cls}-item {
width: math.div(100%, $i);
}
}

display: flex;
flex-wrap: wrap;

> .#{$prefix-cls}-item {
padding: 24px;
cursor: pointer;
border: 0;
border-radius: 0;
box-shadow: 1px 0 #f0f0f0, 0 1px #f0f0f0, 1px 1px #f0f0f0, 1px 0 #f0f0f0 inset, 0 1px #f0f0f0 inset;
transition: all 0.3s;

&:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0,0.15);
}

&.items-direction-column {
flex-direction: column;
}
}

&.items-center > .#{$prefix-cls}-item {
display: flex;
justify-content: center;
align-items: center;
}
}
}
42 changes: 1 addition & 41 deletions src/components/CardGrid/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,44 +55,4 @@ export default defineComponent({
})
</script>

<style lang="scss">
$prefix-cls: '#{$namespace}-card-grid';

.#{$prefix-cls} {
overflow: visible;

&__container {
// @for $i from 1 through 20 {
// &.row-span#{$i} > .#{$prefix-cls}-item {
// width: math.div(100%, $i);
// }
// }

display: flex;
flex-wrap: wrap;

> .#{$prefix-cls}-item {
padding: 24px;
cursor: pointer;
border: 0;
border-radius: 0;
box-shadow: 1px 0 #f0f0f0, 0 1px #f0f0f0, 1px 1px #f0f0f0, 1px 0 #f0f0f0 inset, 0 1px #f0f0f0 inset;
transition: all 0.3s;

&:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0,0.15);
}

&.items-direction-column {
flex-direction: column;
}
}

&.items-center > .#{$prefix-cls}-item {
display: flex;
justify-content: center;
align-items: center;
}
}
}
</style>
<style lang="scss" src="./index.scss"></style>

0 comments on commit 19e50a0

Please sign in to comment.