-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS Modules: Document Card #1149
Merged
micahgodbolt
merged 14 commits into
module-css-updates
from
cmalonzo-cmalonzo/document-css
Feb 28, 2017
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4cf3de5
DetailsList: Fixing scroll utilities to handle body scroll better. (#…
dzearing 5e66f4d
Fix FacePile example onclick for RK. Remove stray commas from Layer/…
leddie24 43cc789
Implement: Contextualmenu gets window from target element. (#387)
joschect 9b3f6f3
v0.56.2
dzearing be71145
Update ListPage.tsx
dzearing 11dc5da
Merge remote-tracking branch 'upstream/master'
cmalonzo e89024c
Merge remote-tracking branch 'upstream/master'
cmalonzo 40b369f
CSSify DocumentCard
cmalonzo 4dcdfcb
Change classnames in document card and fix visual regressions
cmalonzo cf21686
Move DocumentCard styles into one root scss file and move style from …
cmalonzo e01bbac
Merge branch 'cmalonzo/document-css' of https://github.com/cmalonzo/o…
micahgodbolt bf2fe13
Update document card to not rely on persona
micahgodbolt 9c58c22
Moved details styles into global class in document card
micahgodbolt eef9b6c
isFileList to previewIsFilesList
micahgodbolt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
325 changes: 264 additions & 61 deletions
325
packages/office-ui-fabric-react/src/components/DocumentCard/DocumentCard.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,283 @@ | ||
@import '../../common/common'; | ||
|
||
:global { | ||
.ms-DocumentCard { | ||
-webkit-font-smoothing: antialiased; | ||
background-color: $ms-color-white; | ||
border: 1px solid $ms-color-neutralLight; | ||
box-sizing: border-box; | ||
max-width: 320px; | ||
min-width: 206px; | ||
user-select: none; | ||
position: relative; | ||
.root { | ||
-webkit-font-smoothing: antialiased; | ||
background-color: $ms-color-white; | ||
border: 1px solid $ms-color-neutralLight; | ||
box-sizing: border-box; | ||
max-width: 320px; | ||
min-width: 206px; | ||
user-select: none; | ||
position: relative; | ||
} | ||
|
||
.rootIsActionable:hover { | ||
cursor: pointer; | ||
border-color: $ms-color-neutralTertiaryAlt; | ||
|
||
// Place a heavier border within the document card | ||
&:after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
border: 1px solid $ms-color-neutralTertiaryAlt; | ||
pointer-events: none; | ||
} | ||
} | ||
|
||
.ms-DocumentCard--actionable:hover { | ||
cursor: pointer; | ||
border-color: $ms-color-neutralTertiaryAlt; | ||
|
||
// Place a heavier border within the document card | ||
&:after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
border: 1px solid $ms-color-neutralTertiaryAlt; | ||
pointer-events: none; | ||
// When a DocumentCardTitle follows a DocumentCardLocation, we want to reduce the padding | ||
.location + .title { | ||
padding-top: 4px; | ||
} | ||
|
||
// Modifier: Compact layout | ||
.rootIsCompact { | ||
border-bottom: 2px solid $ms-color-neutralTertiary; // Default border color | ||
display: flex; | ||
max-width: 480px; | ||
height: 109px; | ||
|
||
// Remove the usual accent color from the preview | ||
.preview { | ||
border-bottom: none; | ||
max-height: 106px; | ||
max-width: 144px; | ||
|
||
.icon { | ||
:global(.ms-Image-image) { | ||
max-height: 32px; | ||
max-width: 32px; | ||
} | ||
} | ||
} | ||
|
||
// When a DocumentCardTitle follows a DocumentCardLocation, we want to reduce the padding | ||
.ms-DocumentCardLocation + .ms-DocumentCardTitle { | ||
padding-top: 4px; | ||
.preview { | ||
@include border-right(1px, solid, $ms-color-neutralLight); | ||
} | ||
|
||
// Modifier: Compact layout | ||
.ms-DocumentCard--compact { | ||
border-bottom: 2px solid $ms-color-neutralTertiary; // Default border color | ||
display: flex; | ||
max-width: 480px; | ||
height: 109px; | ||
.title { | ||
padding: 12px 16px 8px 16px; | ||
@include ms-font-m; | ||
line-height: 16px; | ||
} | ||
|
||
// Remove the usual accent color from the preview | ||
.ms-DocumentCardPreview { | ||
border-bottom: none; | ||
max-height: 106px; | ||
max-width: 144px; | ||
.activity { | ||
padding-bottom: 12px; | ||
} | ||
} | ||
|
||
.ms-DocumentCardPreview-icon { | ||
.ms-Image-image { | ||
max-height: 32px; | ||
max-width: 32px; | ||
} | ||
} | ||
} | ||
|
||
.ms-DocumentCardPreview { | ||
@include border-right(1px, solid, $ms-color-neutralLight); | ||
} | ||
/** Actions **/ | ||
$ms-DocumentCardActions-actionSize: 34px; | ||
$ms-DocumentCardActions-horizontalPadding: 12px; | ||
$ms-DocumentCardActions-verticalPadding: 4px; | ||
|
||
// Expand the details area to fill the remaining width | ||
.ms-DocumentCard-details { | ||
display: flex; | ||
flex-direction: column; | ||
flex: 1; | ||
justify-content: space-between; | ||
} | ||
.actions { | ||
height: $ms-DocumentCardActions-actionSize; | ||
padding: $ms-DocumentCardActions-verticalPadding $ms-DocumentCardActions-horizontalPadding; | ||
position: relative; | ||
} | ||
|
||
.ms-DocumentCardTitle { | ||
padding: 12px 16px 8px 16px; | ||
@include ms-font-m; | ||
line-height: 16px; | ||
.action { | ||
@include float(left); | ||
@include margin-right(4px); | ||
color: $ms-color-neutralSecondary; | ||
cursor: pointer; | ||
|
||
:global(.ms-Button) { | ||
font-size: 16px; | ||
height: $ms-DocumentCardActions-actionSize; | ||
width: $ms-DocumentCardActions-actionSize; | ||
} | ||
|
||
:global(.ms-Button:hover) { | ||
:global(.ms-Button-icon) { | ||
color: #1174c3; | ||
cursor: pointer; | ||
} | ||
} | ||
} | ||
|
||
.views { | ||
@include text-align(right); | ||
line-height: $ms-DocumentCardActions-actionSize; | ||
|
||
:global(.ms-Icon) { | ||
@include margin-right(4px); | ||
font-size: $ms-icon-size-m; | ||
vertical-align: top; | ||
} | ||
} | ||
|
||
|
||
/** Activity **/ | ||
$ms-DocumentCardActivity-horizontalPadding: 16px; | ||
$ms-DocumentCardActivity-imageSize: 25px; | ||
$ms-DocumentCardActivity-verticalPadding: 8px; | ||
$ms-DocumentCardActivity-personaTextGutter: 8px; | ||
|
||
.activity { | ||
padding: $ms-DocumentCardActivity-verticalPadding $ms-DocumentCardActivity-horizontalPadding; | ||
position: relative; | ||
} | ||
|
||
.activityIsMultiplePeople { | ||
.avatar:nth-of-type(2) { | ||
@include margin-left(-16px); | ||
} | ||
|
||
.activityDetails { | ||
@include left($ms-DocumentCardActivity-horizontalPadding + ($ms-DocumentCardActivity-imageSize * 1.5) + $ms-DocumentCardActivity-personaTextGutter); | ||
} | ||
} | ||
|
||
.avatars { | ||
@include margin-left(-2px); // Avatars sit outside of the usual padding for visual balance | ||
} | ||
|
||
.avatar { | ||
border: 2px solid #fafafa; // Match the background of the card | ||
border-radius: 50%; | ||
height: $ms-DocumentCardActivity-imageSize; | ||
width: $ms-DocumentCardActivity-imageSize; | ||
display: inline-block; | ||
position: relative; | ||
overflow: hidden; | ||
text-align: center; | ||
|
||
:global(.ms-Persona-initials) { | ||
height: $ms-DocumentCardActivity-imageSize; | ||
line-height: $ms-DocumentCardActivity-imageSize; | ||
font-size: $ms-font-size-s; | ||
} | ||
|
||
img { | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 50%; | ||
} | ||
} | ||
|
||
.avatarInitials { | ||
background: $ms-color-themePrimary; | ||
color: $ms-color-white; | ||
font-weight: 100; | ||
} | ||
|
||
.activityDetails { | ||
@include left($ms-DocumentCardActivity-horizontalPadding + $ms-DocumentCardActivity-imageSize + $ms-DocumentCardActivity-personaTextGutter); | ||
height: $ms-DocumentCardActivity-imageSize; | ||
position: absolute; | ||
top: $ms-DocumentCardActivity-verticalPadding; | ||
width: calc(100% - #{$ms-DocumentCardActivity-horizontalPadding + $ms-DocumentCardActivity-imageSize + $ms-DocumentCardActivity-personaTextGutter + $ms-DocumentCardActivity-horizontalPadding}); | ||
} | ||
|
||
.name, | ||
.activityActivity { | ||
display: block; | ||
@include ms-font-s; | ||
color: $ms-color-neutralSecondaryAlt; | ||
line-height: 15px; | ||
height: 15px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
.name { | ||
color: $ms-color-neutralPrimary; | ||
@include ms-fontWeight-semibold; | ||
} | ||
|
||
/** Location **/ | ||
.location { | ||
@include ms-font-s; | ||
color: $ms-color-neutralPrimary; | ||
display: block; | ||
padding: 8px 16px; | ||
position: relative; | ||
text-decoration: none; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
|
||
&:hover { | ||
color: $ms-color-themePrimary; | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
.ms-DocumentCardActivity{ | ||
padding-bottom: 12px; | ||
|
||
/** Preview **/ | ||
.preview { | ||
border-bottom: 2px solid $ms-color-neutralTertiary; // Default border color | ||
position: relative; | ||
background-color: $ms-color-neutralLighterAlt; | ||
overflow: hidden; | ||
|
||
&.isFileList { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
background-color: $ms-color-white; | ||
} | ||
} | ||
|
||
.icon { | ||
@include left(10px); | ||
bottom: 10px; | ||
position: absolute; | ||
} | ||
|
||
.fileList { | ||
@include padding(16px, 16px, 0, 16px); | ||
list-style-type: none; | ||
margin: 0; | ||
|
||
li { | ||
height: 16px; | ||
line-height: 16px; // Vertically center the text | ||
margin-bottom: 8px; | ||
overflow: hidden; | ||
@include padding-left(24px); // Make room for icon | ||
position: relative; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
a { | ||
font-size: $ms-font-size-s; | ||
text-decoration: none; | ||
color: $ms-color-neutralDark; | ||
|
||
&:hover { | ||
color: $ms-color-themePrimary; | ||
} | ||
} | ||
} | ||
|
||
.fileListIcon { | ||
@include left(0); | ||
position: absolute; | ||
top: 0; | ||
} | ||
|
||
.fileListMore { | ||
@include padding(0px, 16px, 8px, 16px); | ||
display: block; | ||
font-size: $ms-font-size-s; | ||
} | ||
|
||
|
||
/** Title **/ | ||
$DocumentCard-title-lineHeight: 21px; | ||
.title { | ||
padding: 8px 16px; | ||
display: block; | ||
@include ms-font-l; | ||
color: $ms-color-neutralPrimary; | ||
height: 38px; // Two lines of text, making sure the third line is hidden | ||
line-height: $DocumentCard-title-lineHeight; | ||
overflow: hidden; | ||
word-wrap: break-word; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these styles part of the example instead of the component?